package ystp.controller;

import jxl.SheetSettings;
import jxl.Workbook;
import jxl.format.UnderlineStyle;
import jxl.write.*;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import ystp.dao.*;
import ystp.model.*;
import ystp.service.*;
import ystp.support.JsonResult;
import ystp.support.PageInfo;
import ystp.support.StringHandle;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.BufferedOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.text.SimpleDateFormat;
import java.util.*;

@RestController
@RequestMapping("fujianjieguo")
public class FujianJieguoController {

    public Logger log = LoggerFactory.getLogger(FujianJieguoController.class);

    @Resource
    public YsxiangmuService ddYsxiangmuService;
    @Resource
    public YsrenyuanfenpeiService ddYsrenyuanfenpeiService;
    @Resource
    public FujianJieguoService ddService;
    @Resource
    public FujianbJieguoService ddFujianbJieguoService;
    @Autowired
    FujianService fujianService;
    @Autowired
    FujianotMapper fujianotMapper;
    @Autowired
    FujiantMapper fujiantMapper;
    @Autowired
    YsuserService ddYsuserService;
    @Autowired
    FujianslMapper fujianslMapper;
    @Autowired
    FujianwMapper fujianwMapper;
    @Autowired
    FujianqMapper fujianqMapper;
    @Autowired
    FujianbMapper fujianbMapper;
    @Autowired
    FujianjsMapper fujianjsMapper;
    @Autowired
    FujiantihuanMapper fujiantihuanMapper;
    @Autowired
    FujianyuanyanMapper fujianyuanyanMapper;
    @Autowired
    FujianshiliuMapper fujianshiliuMapper;
    @Autowired
    FujiankjjibenMapper fujiankjjibenMapper;
    @Autowired
    FujiankjyuecaiMapper fujiankjyuecaiMapper;
    @Autowired
    YsxiangmuService ysxiangmuService;

    @RequestMapping("getjindulist")
    public JsonResult<?> getjindulist(@RequestParam("xiangmuid") String ppxiangmuId){
        try{
            List<Map<String,Object>> mmJindulist = new ArrayList<>();
            Ysxiangmu mmYsxiangmu=ddYsxiangmuService.findOne(ppxiangmuId);

            List<Map<String, Object>> mmUserList=ddYsrenyuanfenpeiService.findRenyuanFenpeiByXiangmuId(ppxiangmuId);
            for(Map<String, Object> ysrenyuanfenpei:mmUserList){
                Map<String, Object> mmMap = new HashMap<String, Object>();
                String mmUserId=ysrenyuanfenpei.get("userid").toString();
                Ysuser mmYsuser=ddYsuserService.findOne(mmUserId);
                String mmUserName=mmYsuser.getUsername();

                int mmPass = ddService.countPass(mmYsxiangmu.getXiangmuleixing(),ppxiangmuId,mmUserId);
                int mmtotalshu = fujianService.countShengchanqiye(mmYsxiangmu.getXiangmuleixing(),ppxiangmuId);


                String mmShifoutijiao="";
                if("1".equals(ysrenyuanfenpei.get("issubmit").toString())){
                    mmShifoutijiao="是";
                }else {
                    mmShifoutijiao="否";
                }

                mmMap.put("username", mmUserName);
                mmMap.put("shengchanqiyeshu", mmPass+"/"+mmtotalshu);
                mmMap.put("shifoutijiao", mmShifoutijiao);
                mmJindulist.add(mmMap);

            }
            return JsonResult.getSuccessResult(mmJindulist);

        }catch (Exception e) {
            e.printStackTrace();
            log.error("fujianjieguo/getjindulist:error",e);
            return JsonResult.getErrorResult("fujianjieguo/getjindulist:error " + e.getMessage());
        }
    }

    @RequestMapping("submit")
    public JsonResult<?> submit(@RequestParam("xiangmuid") String ppXiangmuId,
                                @RequestParam("xiangmuleixing") String ppxiangmuleixing,
                                @RequestParam("userid") String ppUserId) {
        try {
            Ysxiangmu mmYsxiangmu = ddYsxiangmuService.findOne(ppXiangmuId);
            if (mmYsxiangmu.getIsactived() != 1) {
                return JsonResult.getErrorResult("表决失败，投票尚未启动");
            }
            List<Ysrenyuanfenpei> list = ddYsrenyuanfenpeiService.findbyUserIDandXiangmuId(ppUserId, ppXiangmuId);
            if (list.size() < 1) {
                return JsonResult.getErrorResult("提交失败，人员-项目分配信息不存在");
            }

            //本项目某人同意票数
            int mmPass = ddService.countPass(ppxiangmuleixing, ppXiangmuId, ppUserId);

            List<Map<String, Object>> mmPingguiList=fujianService.selectPingui(ppxiangmuleixing,ppXiangmuId,1,9999);

            //附件1
            if ("21".equals(ppxiangmuleixing)) {
               /* int mmzongshu = fujianService.countPingui(ppxiangmuleixing, ppXiangmuId);
                if (mmPass != mmzongshu-1) {
                    return JsonResult.getErrorResult("提交失败，每个序号需要勾选一个生产企业。");
                }*/
                for (int i=0;i<mmPingguiList.size();i++){
                    String mmPingui = mmPingguiList.get(i).get("xuhao").toString();
                    if (!mmPingui.equals("3")){
                        int mmCountPinguiPass = ddService.countPingguiPass(ppXiangmuId,mmPingui,ppUserId);
                        if (mmCountPinguiPass<1){
                            return JsonResult.getErrorResult("提交失败，序号【"+mmPingui+"】未勾选生产企业");
                        }
                    }
                }
            }

            //附件8
            if ("27".equals(ppxiangmuleixing)) {
                for (int i=0;i<mmPingguiList.size();i++){
                    String mmPingui = mmPingguiList.get(i).get("guige").toString();
                    String mmbeuzhu1 = mmPingguiList.get(i).get("beuzhu1").toString();
                    List<Fujianb> mmb=fujianService.findAllByXiangmuId27(ppXiangmuId,mmbeuzhu1);
                    String mmxuhao=mmb.get(0).getXuhao();
                    int mmCountPinguiPass = ddService.countPingguiPass(ppXiangmuId,mmbeuzhu1,ppUserId);
                    if (mmCountPinguiPass<1){
                            return JsonResult.getErrorResult("提交失败，序号【"+mmxuhao+"】规格【"+mmPingui+"】未勾选生产企业");

                    }
                }
            }

            //附件2,5
            if ("22".equals(ppxiangmuleixing)||"25".equals(ppxiangmuleixing)) {
               /* int mmzongshu = fujianService.countPingui(ppxiangmuleixing, ppXiangmuId);
                if (mmPass != mmzongshu) {
                    return JsonResult.getErrorResult("提交失败，每个序号需要勾选一个生产企业。");
                }*/
                for (int i=0;i<mmPingguiList.size();i++){
                    String mmPingui = mmPingguiList.get(i).get("xuhao").toString();
                    int mmCountPinguiPass = ddService.countPingguiPass(ppXiangmuId,mmPingui,ppUserId);
                    if (mmCountPinguiPass<1){
                            return JsonResult.getErrorResult("提交失败，序号【"+mmPingui+"】未勾选生产企业");

                    }
                }
            }
            //附件4,6
            if ("24".equals(ppxiangmuleixing)) {
                List<Fujiansl> mmList = fujianService.findAllByXiangmuId24(ppXiangmuId);
                int mmzongshu = mmList.size();
                if (mmPass != mmzongshu) {
                    return JsonResult.getErrorResult("提交失败，未全部勾选。");
                }
            }
            //附件11,12,13
            if ("29".equals(ppxiangmuleixing)) {
                List<Fujianjs> mmList = fujianService.findAllByXiangmuId29(ppXiangmuId);
                int mmzongshu = mmList.size();
                if (mmPass != mmzongshu) {
                    return JsonResult.getErrorResult("提交失败，未全部勾选。");
                }
            }
            //附件14替换
            if ("30".equals(ppxiangmuleixing)) {
                List<Fujiantihuan> mmList = fujianService.findAllByXiangmuId30(ppXiangmuId);
                int mmzongshu = mmList.size();
                if (mmPass != mmzongshu) {
                    return JsonResult.getErrorResult("提交失败，未全部勾选。");
                }
            }
            //附件16
            if ("32".equals(ppxiangmuleixing)) {
                List<Map<String, Object>> mmList = fujianService.findFeiZhiliaoByXiangmuId(ppXiangmuId, ppUserId);
                if (mmList.size() > 0) {
                    return JsonResult.getErrorResult("提交失败，非治疗用药不能纳入。");
                }
            }

            Ysrenyuanfenpei mmRenyuanfenpei = ddYsrenyuanfenpeiService.findOne(list.get(0).getId());
            mmRenyuanfenpei.setIssubmit(1);
            mmRenyuanfenpei.setUpdatetime(new Date());
            mmRenyuanfenpei.setUpdateby(ppUserId);
            return ddYsrenyuanfenpeiService.update(mmRenyuanfenpei) == true ? JsonResult.getSuccessResult("提交成功")
                    : JsonResult.getErrorResult("提交失败");
        } catch (Exception e) {
            e.printStackTrace();
            log.error("fujianjieguo/submit:error", e);
            return JsonResult.getErrorResult("fujianjieguo/submit:error " + e.getMessage());
        }
    }

    @RequestMapping("vote")
    public JsonResult<?> vote(@RequestParam("id") String ppdetailId,
                              @RequestParam("pinguixuhao") String ppPinguixuhao,
                              @RequestParam("xiangmuleixing") String ppxiangmuleixing,
                              @RequestParam("xiangmuid") String ppxiangmuid,
                              @RequestParam("userid") String ppuserId,
                              @RequestParam("result") String ppresult) {
        try {
            Ysxiangmu mmYsxiangmu = ddYsxiangmuService.findOne(ppxiangmuid);
            if (mmYsxiangmu.getIsactived() != 1) {
                return JsonResult.getErrorResult("表决失败，投票尚未启动");
            }
            FujianJieguo mmjieguo = new FujianJieguo();
            FujianJieguo mmuserjieguo = ddService.checkexistByUserId(ppdetailId, ppuserId, ppxiangmuid);
            if("28".equals(ppxiangmuleixing)){
                if("1".equals(ppresult)){
                    List<Map<String, Object>> mmbeizhu1list= ddService.findBeizhu1(ppxiangmuid);
                    for (int i=0;i<mmbeizhu1list.size();i++){
                        String mmID=mmbeizhu1list.get(i).get("id").toString();
                        if(ppdetailId.equals(mmID)){
                            return JsonResult.getErrorResult("表决失败,不能勾选");
                        }
                    }
                }
            }
            //附件1,2,3,5
            if ("21".equals(ppxiangmuleixing)||"22".equals(ppxiangmuleixing)||"23".equals(ppxiangmuleixing)||"25".equals(ppxiangmuleixing)||"34".equals(ppxiangmuleixing)||"27".equals(ppxiangmuleixing)) {
                if(ppresult.equals("1")) {
                    if("21".equals(ppxiangmuleixing)){
                        if("3".equals(ppPinguixuhao)){
                            return JsonResult.getErrorResult("表决失败,眼科无需求。");
                        }
                    }
                    if("34".equals(ppxiangmuleixing)){
                       int mmpass= ddService.countPass(ppxiangmuleixing,ppxiangmuid,ppuserId);
                       if(mmpass>=2){
                           return  JsonResult.getErrorResult("表决失败,已经勾选两个生产企业。");
                       }
                    }
                    if (ddService.checkCountByPinguiandUserId(ppPinguixuhao, ppuserId,ppxiangmuid) < 1) {
                        if (mmuserjieguo != null) {//已经存在
                            String mmId = mmuserjieguo.getId();
                            mmjieguo.setId(mmId);
                            mmjieguo.setResult(ppresult);
                            mmjieguo.setCreatetime(new Date());
                            return ddService.modify(mmjieguo) == true ? JsonResult.getSuccessResult("表决成功")
                                    : JsonResult.getErrorResult("表决失败");
                        } else {
                            mmjieguo.setId(UUID.randomUUID().toString());
                            mmjieguo.setXuhao(ppPinguixuhao);
                            mmjieguo.setDetailid(ppdetailId);
                            mmjieguo.setUserid(ppuserId);
                            mmjieguo.setResult(ppresult);
                            mmjieguo.setCreatetime(new Date());
                            mmjieguo.setXiangmuid(ppxiangmuid);
                            return ddService.add(mmjieguo) == true ? JsonResult.getSuccessResult("表决成功")
                                    : JsonResult.getErrorResult("表决失败");
                        }
                    } else {
                        return JsonResult.getErrorResult("同一序号的生产企业的勾选数量不能超过1条。");
                    }
                }else{
                    if (mmuserjieguo != null) {//已经存在
                        String mmId = mmuserjieguo.getId();
                        mmjieguo.setId(mmId);
                        mmjieguo.setResult(ppresult);
                        mmjieguo.setCreatetime(new Date());
                        return ddService.modify(mmjieguo) == true ? JsonResult.getSuccessResult("表决成功")
                                : JsonResult.getErrorResult("表决失败");
                    } else {
                        mmjieguo.setId(UUID.randomUUID().toString());
                        mmjieguo.setXuhao(ppPinguixuhao);
                        mmjieguo.setDetailid(ppdetailId);
                        mmjieguo.setUserid(ppuserId);
                        mmjieguo.setResult(ppresult);
                        mmjieguo.setCreatetime(new Date());
                        mmjieguo.setXiangmuid(ppxiangmuid);
                        return ddService.add(mmjieguo) == true ? JsonResult.getSuccessResult("表决成功")
                                : JsonResult.getErrorResult("表决失败");
                    }
                }

            }else{//其他类型

                if (mmuserjieguo != null) {//已经存在
                    String mmId = mmuserjieguo.getId();
                    mmjieguo.setId(mmId);
                    mmjieguo.setResult(ppresult);
                    mmjieguo.setCreatetime(new Date());
                    return ddService.modify(mmjieguo) == true ? JsonResult.getSuccessResult("表决成功")
                            : JsonResult.getErrorResult("表决失败");
                } else {
                    mmjieguo.setId(UUID.randomUUID().toString());
                    mmjieguo.setXuhao(ppPinguixuhao);
                    mmjieguo.setDetailid(ppdetailId);
                    mmjieguo.setUserid(ppuserId);
                    mmjieguo.setResult(ppresult);
                    mmjieguo.setCreatetime(new Date());
                    mmjieguo.setXiangmuid(ppxiangmuid);
                    return ddService.add(mmjieguo) == true ? JsonResult.getSuccessResult("表决成功")
                            : JsonResult.getErrorResult("表决失败");
                }
            }
        } catch (Exception e) {
            e.printStackTrace();
            log.error("fujianjieguo/vote:error", e);
            return JsonResult.getErrorResult("fujianjieguo/vote:error " + e.getMessage());
        }
    }

    @RequestMapping("voteAll")
    public JsonResult<?> voteAll(@RequestParam("xiangmuid") String ppXiangmuId,
                                 @RequestParam("xiangmuleixing") String ppxiangmuleixing,
                                 @RequestParam("userid") String ppUserId) {
        try {
            Ysxiangmu mmYsxiangmu = ddYsxiangmuService.findOne(ppXiangmuId);
            if (mmYsxiangmu.getIsactived() != 1) {
                return JsonResult.getErrorResult("表决失败，投票尚未启动");
            }
            //附件4,6
            if ("24".equals(ppxiangmuleixing)) {
                List<Fujiansl> mmList = fujianService.findAllByXiangmuId24(ppXiangmuId);
                for (Fujiansl mmfujian : mmList) {
                    String mmDetailId = mmfujian.getId();
                    FujianJieguo mmuserjieguo = ddService.checkexistByUserId(mmDetailId, ppUserId, ppXiangmuId);
                    if (mmuserjieguo != null) {//有值
                        mmuserjieguo.setResult("1");
                        mmuserjieguo.setCreatetime(new Date());
                        if (!ddService.modify(mmuserjieguo)) {
                            return JsonResult.getErrorResult("表决失败");
                        }
                    } else {
                        FujianJieguo mmjieguo = new FujianJieguo();
                        mmjieguo.setId(UUID.randomUUID().toString());
                        mmjieguo.setXuhao(mmfujian.getXuhao());
                        mmjieguo.setDetailid(mmDetailId);
                        mmjieguo.setUserid(ppUserId);
                        mmjieguo.setResult("1");
                        mmjieguo.setCreatetime(new Date());
                        mmjieguo.setXiangmuid(ppXiangmuId);
                        if (!ddService.add(mmjieguo)) {
                            return JsonResult.getErrorResult("表决失败");
                        }
                    }
                }
            }
            //附件9,10,11,12,13
            if ("28".equals(ppxiangmuleixing)) {
                List<Fujianjs> mmList = fujianService.findAllByXiangmuId28(ppXiangmuId);
                for (Fujianjs mmfujian : mmList) {
                    String mmDetailId = mmfujian.getId();
                    FujianJieguo mmuserjieguo = ddService.checkexistByUserId(mmDetailId, ppUserId, ppXiangmuId);
                    if (mmuserjieguo != null) {//有值
                        mmuserjieguo.setResult("1");
                        mmuserjieguo.setCreatetime(new Date());
                        if (!ddService.modify(mmuserjieguo)) {
                            return JsonResult.getErrorResult("表决失败");
                        }
                    } else {
                        FujianJieguo mmjieguo = new FujianJieguo();
                        mmjieguo.setId(UUID.randomUUID().toString());
                        mmjieguo.setXuhao(mmfujian.getXuhao());
                        mmjieguo.setDetailid(mmDetailId);
                        mmjieguo.setUserid(ppUserId);
                        mmjieguo.setResult("1");
                        mmjieguo.setCreatetime(new Date());
                        mmjieguo.setXiangmuid(ppXiangmuId);
                        if (!ddService.add(mmjieguo)) {
                            return JsonResult.getErrorResult("表决失败");
                        }
                    }
                }
            }
            if ( "29".equals(ppxiangmuleixing)) {
                List<Fujianjs> mmList = fujianService.findAllByXiangmuId29(ppXiangmuId);
                for (Fujianjs mmfujian : mmList) {
                    String mmDetailId = mmfujian.getId();
                    FujianJieguo mmuserjieguo = ddService.checkexistByUserId(mmDetailId, ppUserId, ppXiangmuId);
                    if (mmuserjieguo != null) {//有值
                        mmuserjieguo.setResult("1");
                        mmuserjieguo.setCreatetime(new Date());
                        if (!ddService.modify(mmuserjieguo)) {
                            return JsonResult.getErrorResult("表决失败");
                        }
                    } else {
                        FujianJieguo mmjieguo = new FujianJieguo();
                        mmjieguo.setId(UUID.randomUUID().toString());
                        mmjieguo.setXuhao(mmfujian.getXuhao());
                        mmjieguo.setDetailid(mmDetailId);
                        mmjieguo.setUserid(ppUserId);
                        mmjieguo.setResult("1");
                        mmjieguo.setCreatetime(new Date());
                        mmjieguo.setXiangmuid(ppXiangmuId);
                        if (!ddService.add(mmjieguo)) {
                            return JsonResult.getErrorResult("表决失败");
                        }
                    }
                }
            }
            //附件14替换
            if ("30".equals(ppxiangmuleixing)) {
                List<Fujiantihuan> mmList = fujianService.findAllByXiangmuId30(ppXiangmuId);
                for (Fujiantihuan mmfujian : mmList) {
                    String mmDetailId = mmfujian.getId();
                    FujianJieguo mmuserjieguo = ddService.checkexistByUserId(mmDetailId, ppUserId, ppXiangmuId);
                    if (mmuserjieguo != null) {//有值
                        mmuserjieguo.setResult("1");
                        mmuserjieguo.setCreatetime(new Date());
                        if (!ddService.modify(mmuserjieguo)) {
                            return JsonResult.getErrorResult("表决失败");
                        }
                    } else {
                        FujianJieguo mmjieguo = new FujianJieguo();
                        mmjieguo.setId(UUID.randomUUID().toString());
                        mmjieguo.setDetailid(mmDetailId);
                        mmjieguo.setXuhao(mmfujian.getXuhao());
                        mmjieguo.setUserid(ppUserId);
                        mmjieguo.setResult("1");
                        mmjieguo.setCreatetime(new Date());
                        mmjieguo.setXiangmuid(ppXiangmuId);
                        if (!ddService.add(mmjieguo)) {
                            return JsonResult.getErrorResult("表决失败");
                        }
                    }
                }
            }
            if ("31".equals(ppxiangmuleixing)) {
                List<Fujianyuanyan> mmList = fujianService.findAllByXiangmuId31(ppXiangmuId);
                for (Fujianyuanyan mmfujian : mmList) {
                    String mmDetailId = mmfujian.getId();
                    FujianJieguo mmuserjieguo = ddService.checkexistByUserId(mmDetailId, ppUserId, ppXiangmuId);
                    if (mmuserjieguo != null) {//有值
                        mmuserjieguo.setResult("1");
                        mmuserjieguo.setCreatetime(new Date());
                        if (!ddService.modify(mmuserjieguo)) {
                            return JsonResult.getErrorResult("表决失败");
                        }
                    } else {
                        FujianJieguo mmjieguo = new FujianJieguo();
                        mmjieguo.setId(UUID.randomUUID().toString());
                        mmjieguo.setDetailid(mmDetailId);
                        mmjieguo.setXuhao(mmfujian.getXuhao());
                        mmjieguo.setUserid(ppUserId);
                        mmjieguo.setResult("1");
                        mmjieguo.setCreatetime(new Date());
                        mmjieguo.setXiangmuid(ppXiangmuId);
                        if (!ddService.add(mmjieguo)) {
                            return JsonResult.getErrorResult("表决失败");
                        }
                    }
                }
            }
            if ("32".equals(ppxiangmuleixing)) {
                List<Fujianshiliu> mmList = fujianService.findAllByXiangmuId32(ppXiangmuId);
                for (Fujianshiliu mmfujian : mmList) {
                    String mmDetailId = mmfujian.getId();
                    FujianJieguo mmuserjieguo = ddService.checkexistByUserId(mmDetailId, ppUserId, ppXiangmuId);
                    if (mmuserjieguo != null) {//有值
                        mmuserjieguo.setResult("1");
                        mmuserjieguo.setCreatetime(new Date());
                        if (!ddService.modify(mmuserjieguo)) {
                            return JsonResult.getErrorResult("表决失败");
                        }
                    } else {
                        FujianJieguo mmjieguo = new FujianJieguo();
                        mmjieguo.setId(UUID.randomUUID().toString());
                        mmjieguo.setDetailid(mmDetailId);
                        mmjieguo.setXuhao(mmfujian.getXuhao());
                        mmjieguo.setUserid(ppUserId);
                        mmjieguo.setResult("1");
                        mmjieguo.setCreatetime(new Date());
                        mmjieguo.setXiangmuid(ppXiangmuId);
                        if (!ddService.add(mmjieguo)) {
                            return JsonResult.getErrorResult("表决失败");
                        }
                    }
                }
            }
            //附件8选品规
            if ("35".equals(ppxiangmuleixing)) {
                List<Fujianb> mmList = fujianService.findByXiangmuId36(ppXiangmuId);
                for (Fujianb mmfujian : mmList) {
                    String mmpinguixuhao = mmfujian.getBeuzhu1();
                    String mmpinzhongxuhao=mmfujian.getXuhao();
                    FujianbJieguo mmuserjieguo = ddFujianbJieguoService.checkexistByUserId(mmpinguixuhao, ppUserId, ppXiangmuId);
                    if (mmuserjieguo != null) {//有值
                        mmuserjieguo.setResult("1");
                        mmuserjieguo.setCreatetime(new Date());
                        if (!ddFujianbJieguoService.modify(mmuserjieguo)) {
                            return JsonResult.getErrorResult("表决失败");
                        }
                    } else {
                        FujianbJieguo mmjieguo = new FujianbJieguo();
                        mmjieguo.setId(UUID.randomUUID().toString());
                        mmjieguo.setPinzhong(mmpinzhongxuhao);
                        mmjieguo.setPingui(mmpinguixuhao);
                        mmjieguo.setUserid(ppUserId);
                        mmjieguo.setResult("1");
                        mmjieguo.setCreatetime(new Date());
                        mmjieguo.setXiangmuid(ppXiangmuId);
                        if (!ddFujianbJieguoService.add(mmjieguo)) {
                            return JsonResult.getErrorResult("表决失败");
                        }
                    }
                }
            }
            return JsonResult.getSuccessResult("表决成功");
        } catch (Exception e) {
            e.printStackTrace();
            log.error("fujianjieguo/voteAll:error", e);
            return JsonResult.getErrorResult("fujianjieguo/voteAll:error " + e.getMessage());
        }
    }

    @RequestMapping("findBiaojuelist")
    public JsonResult<?> findBiaojuelist(@RequestParam("xiangmuid") String ppxiangmuId,
                                         @RequestParam("xiangmuleixing") String ppxiangmuleixing,
                                         @RequestParam("userid") String ppuserId,
                                         @RequestParam("drugname") String ppDrugname,
                                         @RequestParam("pageindex") int ppPageIndex,
                                         @RequestParam("pagesize") int ppPageSize) {
        try {
            List<Map<String, Object>> mmShengchanList = new ArrayList<>();

            List<Map<String, Object>> mmPinguiAll = ddService.findPinguiAll(ppxiangmuleixing, ppxiangmuId, ppDrugname, ppPageIndex, ppPageSize);
            for (int j = 0; j < mmPinguiAll.size(); j++) {
                int mmPinguiHebingshu = 0;
                Map<String, Object> mmPinguiMap = mmPinguiAll.get(j);
                if (mmPinguiMap != null) {
                    String mmPinguiOne = mmPinguiMap.get("xuhao") == null ? "" : mmPinguiMap.get("xuhao").toString();
                    List<Map<String, Object>> mmShengchanqiyelist = ddService.findShengchanqiyeByPinguiResult(ppxiangmuleixing, ppxiangmuId, mmPinguiOne, ppuserId);
                    if (mmShengchanqiyelist.size() > 0) {
                        mmPinguiHebingshu = mmShengchanqiyelist.size();
                    } else {
                        mmPinguiHebingshu = mmPinguiHebingshu + 1;
                    }
                    mmPinguiMap.put("shengchanqiyelist", mmShengchanqiyelist);
                    mmPinguiMap.put("pinguihebinghang", mmPinguiHebingshu);
                }
                mmShengchanList.add(mmPinguiMap);
            }
            Integer mmCount = ddService.getPinguiCount(ppxiangmuleixing, ppxiangmuId, ppPageIndex, ppPageSize);
            PageInfo mmPageInfo = new PageInfo(ppPageIndex, ppPageSize, mmCount);

            Map<String, Object> mmReturnMap = new HashMap<String, Object>();
            mmReturnMap.put("ShengchanList", mmShengchanList);
            mmReturnMap.put("PageInfo", mmPageInfo);
            return JsonResult.getSuccessResult(mmReturnMap);

        } catch (Exception e) {
            e.printStackTrace();
            log.error("fujianjieguo/findBiaojuelist:error", e);
            return JsonResult.getErrorResult("fujianjieguo/findBiaojuelist:error " + e.getMessage());
        }
    }

    @RequestMapping("getResultCount")
    public JsonResult<?> getResultCount(@RequestParam("xiangmuid") String ppXiangmuId,
                                        @RequestParam("xiangmuleixing") String ppxiangmuleixing,
                                        @RequestParam("userid") String ppUserId) {
        try {

            Ysxiangmu mmYsxiangmu = ddYsxiangmuService.findOne(ppXiangmuId);
            if (mmYsxiangmu.getIsactived() != 1) {
                return JsonResult.getErrorResult("投票尚未启动");
            }
            List<Ysrenyuanfenpei> list = ddYsrenyuanfenpeiService.findbyUserIDandXiangmuId(ppUserId, ppXiangmuId);
            if (list.size() < 1) {
                return JsonResult.getErrorResult("人员-项目分配信息不存在");
            }
            int mmPass = ddService.countPass(ppxiangmuleixing, ppXiangmuId, ppUserId);

            Map<String, Object> mmMap = new HashMap<String, Object>();
            mmMap.put("qiyepass", mmPass);
            return JsonResult.getSuccessResult(mmMap);
        } catch (Exception e) {
            e.printStackTrace();
            log.error("fujianjieguo/getResultCount:error", e);
            return JsonResult.getErrorResult("fujianjieguo/getResultCount:error " + e.getMessage());
        }
    }

    // 导出某个委员的签字表
    @RequestMapping("qianzibiao")
    public void qianzibiao(HttpServletRequest request, HttpServletResponse response,
                           @RequestParam("xiangmuid") String ppxiangmuid,
                           @RequestParam("xiangmuleixing") String ppxiangmuleixing,
                           @RequestParam("userid") String ppuserid) {
        try {
            switch (ppxiangmuleixing) {
                case "21":
                    daochuqianzibiao1(ppxiangmuid, ppuserid, request, response);//语句
                    break; //可选
                case "22":
                    daochuqianzibiao2(ppxiangmuid, ppuserid, request, response);//语句
                    break; //可选
                case "23":
                    daochuqianzibiao3(ppxiangmuid, ppuserid, request, response);//语句//语句
                    break; //可选
                case "24":
                    daochuqianzibiao46(ppxiangmuid, ppuserid, request, response);//语句
                    break; //可选
                case "25":
                    daochuqianzibiao5(ppxiangmuid, ppuserid, request, response);//语句
                    break; //可选
                case "26":
                    daochuqianzibiao7(ppxiangmuid, ppuserid, request, response);//语句
                    break; //可选
                case "27":
                    daochuqianzibiao8(ppxiangmuid, ppuserid, request, response);//语句
                    break; //可选
                case "28":
                    daochuqianzibiao910(ppxiangmuid, ppuserid, request, response);//语句
                    break; //可选
                case "29":
                    daochuqianzibiao111213(ppxiangmuid, ppuserid, request, response);//语句
                    break; //可选
                case "30":
                    daochuqianzibiao14tihuan(ppxiangmuid, ppuserid, request, response);//语句
                    break; //可选
                case "31":
                    daochuqianzibiao14yuanyan(ppxiangmuid, ppuserid, request, response);//语句
                    break; //可选
                case "32":
                    daochuqianzibiao16(ppxiangmuid, ppuserid, request, response);//语句
                    break; //可选
                case "33":
                    daochuqianzibiaokjjb(ppxiangmuid, ppuserid, request, response);//语句
                    break; //可选
                case "34":
                    daochuqianzibiaokjyc(ppxiangmuid, ppuserid, request, response);//语句
                    break; //可选
                case "35":
                    daochuqianzibiao8Pingui(ppxiangmuid, ppuserid, request, response);//语句
                    break; //可选
                case "36":
                    daochuqianzibiaokjwufagongying(ppxiangmuid, ppuserid, request, response);//语句
                    break; //可选
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    public void daochuqianzibiao1(@RequestParam("xiangmuid") String ppxiangmuid,
                                   @RequestParam("userid") String ppuserid,
                                   HttpServletRequest request, HttpServletResponse response) {

        response.reset();
        response.setContentType("application/x-download;charset=utf-8");
        List<Map<String, Object>> mmList = fujianotMapper.selectPingui(ppxiangmuid, 0, 99999);
        String xiangmumingcheng = ysxiangmuService.findOne(ppxiangmuid).getXiangmuname();
        Ysuser mmuser = ddYsuserService.findOne(ppuserid);
        String mmusername = mmuser.getUsername();
        OutputStream os = null;
        WritableWorkbook wbook = null;
        try {
            os = new BufferedOutputStream(response.getOutputStream());//得到输出流的语句
            //response.getOutputStream();// 取得输出流
            response.reset();// 清空输出流
            SimpleDateFormat mmDateFormat = new SimpleDateFormat("yyyyMMdd-HHmmss");
            String wenjiantitle = xiangmumingcheng + mmusername + "委员结果表" + StringHandle.tiemString(); //文件名
            String tmptitle = xiangmumingcheng+"（" + mmusername + "）"; // 标题
            response.setHeader("Content-disposition", "attachment; filename=" + new String(wenjiantitle.getBytes(), "iso8859-1") + ".xls");// 设定输出文件头
            response.setContentType("application/vnd.ms-excel");// 定义输出类型
            wbook = Workbook.createWorkbook(os); // 建立excel文件
            WritableSheet wsheet = wbook.createSheet(tmptitle, 0); // sheet名称
            SheetSettings settings = wsheet.getSettings();
            settings.setProtected(true);
            /*  settings.setPassword("0000");*/
            // 设置excel标题
            WritableFont wfont = new WritableFont(WritableFont.createFont("宋体"), 16, WritableFont.BOLD, false, UnderlineStyle.NO_UNDERLINE, Colour.BLACK); //设置表格样式

            WritableCellFormat wcfFC = new WritableCellFormat(wfont);
            wcfFC.setBorder(jxl.format.Border.ALL, jxl.format.BorderLineStyle.THIN); // 添加边框
            wcfFC.setVerticalAlignment(VerticalAlignment.CENTRE);   //设置居中对齐
            wcfFC.setAlignment(Alignment.CENTRE);

            WritableCellFormat wcfFC3 = new WritableCellFormat(wfont);
            wcfFC3.setVerticalAlignment(VerticalAlignment.CENTRE);   //设置居中对齐
            wcfFC3.setAlignment(Alignment.CENTRE);
            //wcfFC.setBackground(Colour.AQUA);
            Label label = new Label(0, 0, tmptitle, wcfFC3);

            WritableCellFormat cellFormat = new WritableCellFormat();
            cellFormat.setAlignment(jxl.format.Alignment.CENTRE);
            cellFormat.setVerticalAlignment(jxl.format.VerticalAlignment.CENTRE);
            cellFormat.setWrap(true);
            //cellFormat.setBackground(Colour.AQUA);
            cellFormat.setFont(wfont);
            label.setCellFormat(cellFormat);
            wsheet.addCell(label);
            wsheet.addCell(new Label(0, 0, tmptitle, wcfFC3));
            /*wsheet.addCell(new Label(7, 0, tmptitle, wcfFC));*/
            wsheet.setRowView(0, 600); //第一行高度
            wsheet.setRowView(1, 600); //第二行高度
            wsheet.mergeCells(0, 0, 13, 0);  //合并单元格(第一列的第一行和第十三列的第一行合并)
            wsheet.setColumnView(0, 6); //宽度
            wsheet.setColumnView(1, 14); //宽度
            wsheet.setColumnView(2, 14); //药品名称宽度
            wsheet.setColumnView(3, 10); //分类宽度
            wsheet.setColumnView(4, 10); //规格宽度
            wsheet.setColumnView(5, 10); //单位宽度
            wsheet.setColumnView(6, 24); //医保宽度
            wsheet.setColumnView(7, 10); //宽度
            wsheet.setColumnView(8, 10); //宽度
            wsheet.setColumnView(9, 10); //宽度
            wsheet.setColumnView(10, 10); //宽度
            wsheet.setColumnView(11, 10); //宽度
            wsheet.setColumnView(12, 10); //宽度
            wsheet.setColumnView(13, 15); //宽度




            // 开始生成主体内容
            wfont = new jxl.write.WritableFont(WritableFont.createFont("方正小标宋简体"), 11, WritableFont.BOLD, false, UnderlineStyle.NO_UNDERLINE, Colour.BLACK);
            wcfFC = new WritableCellFormat(wfont);
            wcfFC.setBorder(jxl.format.Border.ALL, jxl.format.BorderLineStyle.THIN);
            wcfFC.setVerticalAlignment(VerticalAlignment.CENTRE);   //设置居中对齐
            wcfFC.setAlignment(Alignment.CENTRE);
            wcfFC.setWrap(true);
            // 不需要边框和居中的样式
            WritableFont wfont2 = new WritableFont(WritableFont.ARIAL, 12, WritableFont.BOLD, false, UnderlineStyle.NO_UNDERLINE, Colour.BLACK); //设置表格样式
            WritableCellFormat wcfFC2 = new WritableCellFormat(wfont2);
            wcfFC2.setVerticalAlignment(jxl.format.VerticalAlignment.CENTRE);// 垂直居中
            wcfFC2 = new WritableCellFormat(wfont2);
            wcfFC2.setWrap(true);
            //  在  1 列  2 行 写入内容
            wsheet.addCell(new Label(0, 1, "投票人(签字):投票内容已核对无误。" + mmusername, wcfFC2));
            // 把  0 列 2 行 到 9 列 2 行合并
            wsheet.mergeCells(0, 1, 7, 1);


            wsheet.addCell(new Label(8, 1, "投票日期:" + StringHandle.shorttiemString(), wcfFC2));
            wsheet.mergeCells(8, 1, 13, 1);

            // 第三行 内容
            wsheet.addCell(new Label(0, 2, "序号", wcfFC));
            wsheet.addCell(new Label(1, 2, "产品编码", wcfFC));
            wsheet.addCell(new Label(2, 2, "药品名称", wcfFC));
            wsheet.addCell(new Label(3, 2, "规格", wcfFC));
            wsheet.addCell(new Label(4, 2, "单位", wcfFC));
            wsheet.addCell(new Label(5, 2, "剂型", wcfFC));
            wsheet.addCell(new Label(6, 2, "生产企业", wcfFC));
            wsheet.addCell(new Label(7, 2, "价格（元）", wcfFC));
            wsheet.addCell(new Label(8, 2, "基药", wcfFC));
            wsheet.addCell(new Label(9, 2, "医保", wcfFC));
            wsheet.addCell(new Label(10, 2, "一致性评价", wcfFC));
            wsheet.addCell(new Label(11, 2, "临床有无需求", wcfFC));
            wsheet.addCell(new Label(12, 2, "备注", wcfFC));
            wsheet.addCell(new Label(13, 2, "表决意见", wcfFC));


            // 表头结束

            wfont = new jxl.write.WritableFont(WritableFont.createFont("宋体"), 11, WritableFont.NO_BOLD, false, UnderlineStyle.NO_UNDERLINE, Colour.BLACK);
            wcfFC = new WritableCellFormat(wfont);
            wcfFC.setBorder(jxl.format.Border.ALL, jxl.format.BorderLineStyle.THIN);
            wcfFC.setVerticalAlignment(VerticalAlignment.CENTRE);   //设置居中对齐
            wcfFC.setAlignment(Alignment.CENTRE);
            wcfFC.setWrap(true);

            int count = mmList.size();
            int mmpinzhongKaishihang = 3;
            int mmpinpaiKaishihang = 3;


            for (int i = 0; i < count; i++) {
                Map<String, Object> mmPinzhongMap = mmList.get(i);

                String mmPinzhongOne = mmPinzhongMap.get("xuhao") == null ? "" : mmPinzhongMap.get("xuhao").toString();
                int mmHebingshu = 0;

                List<Map<String, Object>> mmPinguilist = fujianotMapper.findShengchanqiyeByPinguiResult(ppxiangmuid, mmPinzhongOne, ppuserid);
                if (mmPinguilist.size() > 0) {
                    mmHebingshu = mmPinguilist.size() - 1;
                }
                for (int j = 0; j < mmPinguilist.size(); j++) {
                    Map<String, Object> mmPinguiMap = mmPinguilist.get(j);
                    if (mmPinguiMap != null) {
                        String chanpinbianma = mmPinguiMap.get("chanpinbianma") == null ? "" : mmPinguiMap.get("chanpinbianma").toString();
                        String yaopinmingcheng = mmPinguiMap.get("yaopinmingcheng") == null ? "" : mmPinguiMap.get("yaopinmingcheng").toString();
                        String guige = mmPinguiMap.get("guige") == null ? "" : mmPinguiMap.get("guige").toString();
                        String danwei = mmPinguiMap.get("danwei") == null ? "" : mmPinguiMap.get("danwei").toString();
                        String jixing = mmPinguiMap.get("jixing") == null ? "" : mmPinguiMap.get("jixing").toString();
                        String shengchanqiye = mmPinguiMap.get("shengchanqiye") == null ? "" : mmPinguiMap.get("shengchanqiye").toString();
                        String jiage = mmPinguiMap.get("jiage") == null ? "" : mmPinguiMap.get("jiage").toString();
                        String jiyao = mmPinguiMap.get("jiyao") == null ? "" : mmPinguiMap.get("jiyao").toString();
                        String yibao = mmPinguiMap.get("yibao") == null ? "" : mmPinguiMap.get("yibao").toString();
                        String yizhixingpingjia = mmPinguiMap.get("yizhixingpingjia") == null ? "" : mmPinguiMap.get("yizhixingpingjia").toString();
                        String youwuxuqiu = mmPinguiMap.get("youwuxuqiu") == null ? "" : mmPinguiMap.get("youwuxuqiu").toString();
                        String beizhu = mmPinguiMap.get("beizhu") == null ? "" : mmPinguiMap.get("beizhu").toString();

                        String mmresult = mmPinguiMap.get("result") == null ? "" : mmPinguiMap.get("result").toString();
                        String mmbiaojueren = mmPinguiMap.get("username") == null ? "" : mmPinguiMap.get("username").toString();
                        String mmyijian = "";
                        System.out.println("@" + mmPinguiMap);
                        if ("1".equals(mmresult)) {
                            mmyijian = "同意";
                        } else if ("0".equals(mmresult)) {
                            mmyijian = "不同意";
                        } else {
                            mmyijian = "不同意";
                        }
                        wsheet.addCell(new Label(1, mmpinpaiKaishihang, chanpinbianma, wcfFC));
                        wsheet.addCell(new Label(2, mmpinpaiKaishihang, yaopinmingcheng, wcfFC));
                        wsheet.addCell(new Label(3, mmpinpaiKaishihang, guige, wcfFC));
                        wsheet.addCell(new Label(4, mmpinpaiKaishihang, danwei, wcfFC));
                        wsheet.addCell(new Label(5, mmpinpaiKaishihang, jixing, wcfFC));
                        wsheet.addCell(new Label(6, mmpinpaiKaishihang, shengchanqiye, wcfFC));
                        wsheet.addCell(new Label(7, mmpinpaiKaishihang, jiage, wcfFC));
                        wsheet.addCell(new Label(8, mmpinpaiKaishihang, jiyao, wcfFC));
                        wsheet.addCell(new Label(9, mmpinpaiKaishihang, yibao, wcfFC));
                        wsheet.addCell(new Label(10, mmpinpaiKaishihang, yizhixingpingjia, wcfFC));
                        wsheet.addCell(new Label(11, mmpinpaiKaishihang, youwuxuqiu, wcfFC));
                        wsheet.addCell(new Label(12, mmpinpaiKaishihang, beizhu, wcfFC));
                        wsheet.addCell(new Label(13, mmpinpaiKaishihang, mmyijian, wcfFC));
                        mmpinpaiKaishihang = mmpinpaiKaishihang + 1;
                    }
                }
                wsheet.addCell(new Label(0, mmpinzhongKaishihang, mmPinzhongOne, wcfFC));
                wsheet.mergeCells(0, mmpinzhongKaishihang, 0, mmpinzhongKaishihang + mmHebingshu);
                mmpinzhongKaishihang = mmpinzhongKaishihang + mmHebingshu + 1;

            }
            wbook.write(); // 写入文件
            wbook.close();
        } catch (Exception ex) {
            ex.printStackTrace();
        } finally {
            if (os != null) {
                try {
                    os.close();
                } catch (IOException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }
            }
        }
    }
    public void daochuqianzibiao2(@RequestParam("xiangmuid") String ppxiangmuid,
                                   @RequestParam("userid") String ppuserid,
                                   HttpServletRequest request, HttpServletResponse response) {

        response.reset();
        response.setContentType("application/x-download;charset=utf-8");
        List<Map<String, Object>> mmList = fujianotMapper.selectPingui(ppxiangmuid, 0, 99999);
        Ysuser mmuser = ddYsuserService.findOne(ppuserid);
        String xiangmumingcheng = ysxiangmuService.findOne(ppxiangmuid).getXiangmuname();
        String mmusername = mmuser.getUsername();
        OutputStream os = null;
        WritableWorkbook wbook = null;
        try {
            os = new BufferedOutputStream(response.getOutputStream());//得到输出流的语句
            //response.getOutputStream();// 取得输出流
            response.reset();// 清空输出流
            SimpleDateFormat mmDateFormat = new SimpleDateFormat("yyyyMMdd-HHmmss");
            String wenjiantitle = xiangmumingcheng + mmusername + "委员结果表" + StringHandle.tiemString(); //文件名
            String tmptitle = xiangmumingcheng+"（" + mmusername + "）"; // 标题
            response.setHeader("Content-disposition", "attachment; filename=" + new String(wenjiantitle.getBytes(), "iso8859-1") + ".xls");// 设定输出文件头
            response.setContentType("application/vnd.ms-excel");// 定义输出类型
            wbook = Workbook.createWorkbook(os); // 建立excel文件
            WritableSheet wsheet = wbook.createSheet(tmptitle, 0); // sheet名称
            SheetSettings settings = wsheet.getSettings();
            settings.setProtected(true);
            /*  settings.setPassword("0000");*/
            // 设置excel标题
            WritableFont wfont = new WritableFont(WritableFont.createFont("宋体"), 16, WritableFont.BOLD, false, UnderlineStyle.NO_UNDERLINE, Colour.BLACK); //设置表格样式

            WritableCellFormat wcfFC = new WritableCellFormat(wfont);
            wcfFC.setBorder(jxl.format.Border.ALL, jxl.format.BorderLineStyle.THIN); // 添加边框
            wcfFC.setVerticalAlignment(VerticalAlignment.CENTRE);   //设置居中对齐
            wcfFC.setAlignment(Alignment.CENTRE);

            WritableCellFormat wcfFC3 = new WritableCellFormat(wfont);
            wcfFC3.setVerticalAlignment(VerticalAlignment.CENTRE);   //设置居中对齐
            wcfFC3.setAlignment(Alignment.CENTRE);
            //wcfFC.setBackground(Colour.AQUA);
            Label label = new Label(0, 0, tmptitle, wcfFC3);

            WritableCellFormat cellFormat = new WritableCellFormat();
            cellFormat.setAlignment(jxl.format.Alignment.CENTRE);
            cellFormat.setVerticalAlignment(jxl.format.VerticalAlignment.CENTRE);
            cellFormat.setWrap(true);
            //cellFormat.setBackground(Colour.AQUA);
            cellFormat.setFont(wfont);
            label.setCellFormat(cellFormat);
            wsheet.addCell(label);
            wsheet.addCell(new Label(0, 0, tmptitle, wcfFC3));
            /*wsheet.addCell(new Label(7, 0, tmptitle, wcfFC));*/
            wsheet.setRowView(0, 600); //第一行高度
            wsheet.setRowView(1, 600); //第二行高度
            wsheet.mergeCells(0, 0, 12, 0);  //合并单元格(第一列的第一行和第十三列的第一行合并)
            wsheet.setColumnView(0, 14); //宽度
            wsheet.setColumnView(1, 14); //宽度
            wsheet.setColumnView(2, 14); //药品名称宽度
            wsheet.setColumnView(3, 14); //分类宽度
            wsheet.setColumnView(4, 14); //规格宽度
            wsheet.setColumnView(5, 14); //单位宽度
            wsheet.setColumnView(6, 14); //医保宽度
            wsheet.setColumnView(7, 14); //宽度
            wsheet.setColumnView(8, 14); //宽度
            wsheet.setColumnView(9, 14); //宽度
            wsheet.setColumnView(10, 14); //宽度
            wsheet.setColumnView(11, 14); //宽度
            wsheet.setColumnView(12, 14); //宽度



            // 开始生成主体内容
            wfont = new jxl.write.WritableFont(WritableFont.createFont("方正小标宋简体"), 11, WritableFont.BOLD, false, UnderlineStyle.NO_UNDERLINE, Colour.BLACK);
            wcfFC = new WritableCellFormat(wfont);
            wcfFC.setBorder(jxl.format.Border.ALL, jxl.format.BorderLineStyle.THIN);
            wcfFC.setVerticalAlignment(VerticalAlignment.CENTRE);   //设置居中对齐
            wcfFC.setAlignment(Alignment.CENTRE);
            wcfFC.setWrap(true);
            // 不需要边框和居中的样式
            WritableFont wfont2 = new WritableFont(WritableFont.ARIAL, 12, WritableFont.BOLD, false, UnderlineStyle.NO_UNDERLINE, Colour.BLACK); //设置表格样式
            WritableCellFormat wcfFC2 = new WritableCellFormat(wfont2);
            wcfFC2.setVerticalAlignment(jxl.format.VerticalAlignment.CENTRE);// 垂直居中
            wcfFC2 = new WritableCellFormat(wfont2);
            wcfFC2.setWrap(true);
            //  在  1 列  2 行 写入内容
            wsheet.addCell(new Label(0, 1, "投票人(签字):投票内容已核对无误。" + mmusername, wcfFC2));
            // 把  0 列 2 行 到 9 列 2 行合并
            wsheet.mergeCells(0, 1, 7, 1);


            wsheet.addCell(new Label(8, 1, "投票日期:" + StringHandle.shorttiemString(), wcfFC2));
            wsheet.mergeCells(8, 1, 12, 1);

            // 第三行 内容
            wsheet.addCell(new Label(0, 2, "序号", wcfFC));
            wsheet.addCell(new Label(1, 2, "产品编码", wcfFC));
            wsheet.addCell(new Label(2, 2, "药品名称", wcfFC));
            wsheet.addCell(new Label(3, 2, "规格", wcfFC));
            wsheet.addCell(new Label(4, 2, "单位", wcfFC));
            wsheet.addCell(new Label(5, 2, "剂型", wcfFC));
            wsheet.addCell(new Label(6, 2, "生产企业", wcfFC));
            wsheet.addCell(new Label(7, 2, "价格（元）", wcfFC));
            wsheet.addCell(new Label(8, 2, "基药", wcfFC));
            wsheet.addCell(new Label(9, 2, "医保", wcfFC));
            wsheet.addCell(new Label(10, 2, "一致性评价", wcfFC));
            wsheet.addCell(new Label(11, 2, "备注", wcfFC));
            wsheet.addCell(new Label(12, 2, "表决意见", wcfFC));


            // 表头结束

            wfont = new jxl.write.WritableFont(WritableFont.createFont("宋体"), 11, WritableFont.NO_BOLD, false, UnderlineStyle.NO_UNDERLINE, Colour.BLACK);
            wcfFC = new WritableCellFormat(wfont);
            wcfFC.setBorder(jxl.format.Border.ALL, jxl.format.BorderLineStyle.THIN);
            wcfFC.setVerticalAlignment(VerticalAlignment.CENTRE);   //设置居中对齐
            wcfFC.setAlignment(Alignment.CENTRE);
            wcfFC.setWrap(true);

            int count = mmList.size();
            int mmpinzhongKaishihang = 3;
            int mmpinpaiKaishihang = 3;


            for (int i = 0; i < count; i++) {
                Map<String, Object> mmPinzhongMap = mmList.get(i);

                String mmPinzhongOne = mmPinzhongMap.get("xuhao") == null ? "" : mmPinzhongMap.get("xuhao").toString();
                int mmHebingshu = 0;

                List<Map<String, Object>> mmPinguilist = fujianotMapper.findShengchanqiyeByPinguiResult(ppxiangmuid, mmPinzhongOne, ppuserid);
                if (mmPinguilist.size() > 0) {
                    mmHebingshu = mmPinguilist.size() - 1;
                }
                for (int j = 0; j < mmPinguilist.size(); j++) {
                    Map<String, Object> mmPinguiMap = mmPinguilist.get(j);
                    if (mmPinguiMap != null) {
                        String chanpinbianma = mmPinguiMap.get("chanpinbianma") == null ? "" : mmPinguiMap.get("chanpinbianma").toString();
                        String yaopinmingcheng = mmPinguiMap.get("yaopinmingcheng") == null ? "" : mmPinguiMap.get("yaopinmingcheng").toString();
                        String guige = mmPinguiMap.get("guige") == null ? "" : mmPinguiMap.get("guige").toString();
                        String danwei = mmPinguiMap.get("danwei") == null ? "" : mmPinguiMap.get("danwei").toString();
                        String jixing = mmPinguiMap.get("jixing") == null ? "" : mmPinguiMap.get("jixing").toString();
                        String shengchanqiye = mmPinguiMap.get("shengchanqiye") == null ? "" : mmPinguiMap.get("shengchanqiye").toString();
                        String jiage = mmPinguiMap.get("jiage") == null ? "" : mmPinguiMap.get("jiage").toString();
                        String jiyao = mmPinguiMap.get("jiyao") == null ? "" : mmPinguiMap.get("jiyao").toString();
                        String yibao = mmPinguiMap.get("yibao") == null ? "" : mmPinguiMap.get("yibao").toString();
                        String yizhixingpingjia = mmPinguiMap.get("yizhixingpingjia") == null ? "" : mmPinguiMap.get("yizhixingpingjia").toString();
                        String beizhu = mmPinguiMap.get("beizhu") == null ? "" : mmPinguiMap.get("beizhu").toString();

                        String mmresult = mmPinguiMap.get("result") == null ? "" : mmPinguiMap.get("result").toString();
                        String mmbiaojueren = mmPinguiMap.get("username") == null ? "" : mmPinguiMap.get("username").toString();
                        String mmyijian = "";
                        System.out.println("@" + mmPinguiMap);
                        if ("1".equals(mmresult)) {
                            mmyijian = "同意";
                        } else if ("0".equals(mmresult)) {
                            mmyijian = "不同意";
                        } else {
                            mmyijian = "不同意";
                        }
                        wsheet.addCell(new Label(1, mmpinpaiKaishihang, chanpinbianma, wcfFC));
                        wsheet.addCell(new Label(2, mmpinpaiKaishihang, yaopinmingcheng, wcfFC));
                        wsheet.addCell(new Label(3, mmpinpaiKaishihang, guige, wcfFC));
                        wsheet.addCell(new Label(4, mmpinpaiKaishihang, danwei, wcfFC));
                        wsheet.addCell(new Label(5, mmpinpaiKaishihang, jixing, wcfFC));
                        wsheet.addCell(new Label(6, mmpinpaiKaishihang, shengchanqiye, wcfFC));
                        wsheet.addCell(new Label(7, mmpinpaiKaishihang, jiage, wcfFC));
                        wsheet.addCell(new Label(8, mmpinpaiKaishihang, jiyao, wcfFC));
                        wsheet.addCell(new Label(9, mmpinpaiKaishihang, yibao, wcfFC));
                        wsheet.addCell(new Label(10, mmpinpaiKaishihang, yizhixingpingjia, wcfFC));
                        wsheet.addCell(new Label(11, mmpinpaiKaishihang, beizhu, wcfFC));
                        wsheet.addCell(new Label(12, mmpinpaiKaishihang, mmyijian, wcfFC));
                        mmpinpaiKaishihang = mmpinpaiKaishihang + 1;
                    }
                }
                wsheet.addCell(new Label(0, mmpinzhongKaishihang, mmPinzhongOne, wcfFC));
                wsheet.mergeCells(0, mmpinzhongKaishihang, 0, mmpinzhongKaishihang + mmHebingshu);
                mmpinzhongKaishihang = mmpinzhongKaishihang + mmHebingshu + 1;

            }
            wbook.write(); // 写入文件
            wbook.close();
        } catch (Exception ex) {
            ex.printStackTrace();
        } finally {
            if (os != null) {
                try {
                    os.close();
                } catch (IOException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }
            }
        }
    }
    public void daochuqianzibiao3(@RequestParam("xiangmuid") String ppxiangmuid,
                                  @RequestParam("userid") String ppuserid,
                                  HttpServletRequest request, HttpServletResponse response) {

        response.reset();
        response.setContentType("application/x-download;charset=utf-8");
        List<Map<String, Object>> mmList = fujiantMapper.selectPingui(ppxiangmuid, 0, 99999);
        Ysuser mmuser = ddYsuserService.findOne(ppuserid);
        String xiangmumingcheng = ysxiangmuService.findOne(ppxiangmuid).getXiangmuname();
        String mmusername = mmuser.getUsername();
        OutputStream os = null;
        WritableWorkbook wbook = null;
        try {
            os = new BufferedOutputStream(response.getOutputStream());//得到输出流的语句
            //response.getOutputStream();// 取得输出流
            response.reset();// 清空输出流
            SimpleDateFormat mmDateFormat = new SimpleDateFormat("yyyyMMdd-HHmmss");
            String wenjiantitle = xiangmumingcheng + mmusername + "委员结果表" + StringHandle.tiemString(); //文件名
            String tmptitle = xiangmumingcheng+"（" + mmusername + "）"; // 标题
            response.setHeader("Content-disposition", "attachment; filename=" + new String(wenjiantitle.getBytes(), "iso8859-1") + ".xls");// 设定输出文件头
            response.setContentType("application/vnd.ms-excel");// 定义输出类型
            wbook = Workbook.createWorkbook(os); // 建立excel文件
            WritableSheet wsheet = wbook.createSheet(tmptitle, 0); // sheet名称
            SheetSettings settings = wsheet.getSettings();
            settings.setProtected(true);
            /*  settings.setPassword("0000");*/
            // 设置excel标题
            WritableFont wfont = new WritableFont(WritableFont.ARIAL, 16, WritableFont.BOLD, false, UnderlineStyle.NO_UNDERLINE, Colour.BLACK); //设置表格样式

            WritableCellFormat wcfFC = new WritableCellFormat(wfont);
            wcfFC.setBorder(jxl.format.Border.ALL, jxl.format.BorderLineStyle.THIN); // 添加边框
            wcfFC.setVerticalAlignment(VerticalAlignment.CENTRE);   //设置居中对齐
            wcfFC.setAlignment(Alignment.CENTRE);

            WritableCellFormat wcfFC3 = new WritableCellFormat(wfont);
            wcfFC3.setVerticalAlignment(VerticalAlignment.CENTRE);   //设置居中对齐
            wcfFC3.setAlignment(Alignment.CENTRE);
            //wcfFC.setBackground(Colour.AQUA);
            Label label = new Label(0, 0, tmptitle, wcfFC3);

            WritableCellFormat cellFormat = new WritableCellFormat();
            cellFormat.setAlignment(jxl.format.Alignment.CENTRE);
            cellFormat.setVerticalAlignment(jxl.format.VerticalAlignment.CENTRE);
            cellFormat.setWrap(true);
            //cellFormat.setBackground(Colour.AQUA);
            cellFormat.setFont(wfont);
            label.setCellFormat(cellFormat);
            wsheet.addCell(label);
            wsheet.addCell(new Label(0, 0, tmptitle, wcfFC3));
            /*wsheet.addCell(new Label(7, 0, tmptitle, wcfFC));*/
            wsheet.setRowView(0, 600); //第一行高度
            wsheet.setRowView(1, 600); //第二行高度
            wsheet.mergeCells(0, 0, 15, 0);  //合并单元格(第一列的第一行和第十三列的第一行合并)
            wsheet.setColumnView(0, 14); //宽度
            wsheet.setColumnView(1, 14); //宽度
            wsheet.setColumnView(2, 14); //药品名称宽度
            wsheet.setColumnView(3, 14); //分类宽度
            wsheet.setColumnView(4, 14); //规格宽度
            wsheet.setColumnView(5, 14); //单位宽度
            wsheet.setColumnView(6, 14); //医保宽度
            wsheet.setColumnView(7, 14); //宽度
            wsheet.setColumnView(8, 14); //宽度
            wsheet.setColumnView(9, 14); //宽度
            wsheet.setColumnView(10, 14); //宽度
            wsheet.setColumnView(11, 14); //宽度
            wsheet.setColumnView(12, 14); //宽度
            wsheet.setColumnView(13, 14); //院本部宽度
            wsheet.setColumnView(14, 14); //宽度
            wsheet.setColumnView(15, 14); //宽度


            // 开始生成主体内容
            wfont = new jxl.write.WritableFont(WritableFont.ARIAL, 10, WritableFont.BOLD, false, UnderlineStyle.NO_UNDERLINE, Colour.BLACK);
            wcfFC = new WritableCellFormat(wfont);
            wcfFC.setBorder(jxl.format.Border.ALL, jxl.format.BorderLineStyle.THIN);
            wcfFC.setVerticalAlignment(VerticalAlignment.CENTRE);   //设置居中对齐
            wcfFC.setAlignment(Alignment.CENTRE);
            wcfFC.setWrap(true);
            // 不需要边框和居中的样式
            WritableFont wfont2 = new WritableFont(WritableFont.ARIAL, 12, WritableFont.BOLD, false, UnderlineStyle.NO_UNDERLINE, Colour.BLACK); //设置表格样式
            WritableCellFormat wcfFC2 = new WritableCellFormat(wfont2);
            wcfFC2.setVerticalAlignment(jxl.format.VerticalAlignment.CENTRE);// 垂直居中
            wcfFC2 = new WritableCellFormat(wfont2);
            wcfFC2.setWrap(true);
            //  在  1 列  2 行 写入内容
            wsheet.addCell(new Label(0, 1, "投票人(签字):投票内容已核对无误。" + mmusername, wcfFC2));
            // 把  0 列 2 行 到 9 列 2 行合并
            wsheet.mergeCells(0, 1, 9, 1);


            wsheet.addCell(new Label(10, 1, "投票日期:" + StringHandle.shorttiemString(), wcfFC2));
            wsheet.mergeCells(10, 1, 15, 1);

            // 第三行 内容
            wsheet.addCell(new Label(0, 2, "序号", wcfFC));
            wsheet.addCell(new Label(1, 2, "产品编码", wcfFC));
            wsheet.addCell(new Label(2, 2, "药品名称", wcfFC));
            wsheet.addCell(new Label(3, 2, "规格", wcfFC));
            wsheet.addCell(new Label(4, 2, "单位", wcfFC));
            wsheet.addCell(new Label(5, 2, "剂型", wcfFC));
            wsheet.addCell(new Label(6, 2, "生产企业", wcfFC));
            wsheet.addCell(new Label(7, 2, "价格（元）", wcfFC));
            wsheet.addCell(new Label(8, 2, "基药", wcfFC));
            wsheet.addCell(new Label(9, 2, "医保", wcfFC));
            wsheet.addCell(new Label(10, 2, "一致性评价", wcfFC));
            wsheet.addCell(new Label(11, 2, "申请科室", wcfFC));
            wsheet.addCell(new Label(12, 2, "申请总次数", wcfFC));
            wsheet.addCell(new Label(13, 2, "申请总数量", wcfFC));
            wsheet.addCell(new Label(14, 2, "备注", wcfFC));
            wsheet.addCell(new Label(15, 2, "表决意见", wcfFC));


            // 表头结束

            wfont = new jxl.write.WritableFont(WritableFont.ARIAL, 10, WritableFont.NO_BOLD, false, UnderlineStyle.NO_UNDERLINE, Colour.BLACK);
            wcfFC = new WritableCellFormat(wfont);
            wcfFC.setBorder(jxl.format.Border.ALL, jxl.format.BorderLineStyle.THIN);
            wcfFC.setVerticalAlignment(VerticalAlignment.CENTRE);   //设置居中对齐
            wcfFC.setAlignment(Alignment.CENTRE);
            wcfFC.setWrap(true);

            int count = mmList.size();
            int mmpinzhongKaishihang = 3;
            int mmpinpaiKaishihang = 3;


            for (int i = 0; i < count; i++) {
                Map<String, Object> mmPinzhongMap = mmList.get(i);

                String mmPinzhongOne = mmPinzhongMap.get("xuhao") == null ? "" : mmPinzhongMap.get("xuhao").toString();
                int mmHebingshu = 0;

                List<Map<String, Object>> mmPinguilist = fujiantMapper.findShengchanqiyeByPinguiResult(ppxiangmuid, mmPinzhongOne, ppuserid);
                if (mmPinguilist.size() > 0) {
                    mmHebingshu = mmPinguilist.size() - 1;
                }
                for (int j = 0; j < mmPinguilist.size(); j++) {
                    Map<String, Object> mmPinguiMap = mmPinguilist.get(j);
                    if (mmPinguiMap != null) {
                        String chanpinbianma = mmPinguiMap.get("chanpinbianma") == null ? "" : mmPinguiMap.get("chanpinbianma").toString();
                        String yaopinmingcheng = mmPinguiMap.get("yaopinmingcheng") == null ? "" : mmPinguiMap.get("yaopinmingcheng").toString();
                        String guige = mmPinguiMap.get("guige") == null ? "" : mmPinguiMap.get("guige").toString();
                        String danwei = mmPinguiMap.get("danwei") == null ? "" : mmPinguiMap.get("danwei").toString();
                        String jixing = mmPinguiMap.get("jixing") == null ? "" : mmPinguiMap.get("jixing").toString();
                        String shengchanqiye = mmPinguiMap.get("shengchanqiye") == null ? "" : mmPinguiMap.get("shengchanqiye").toString();
                        String jiage = mmPinguiMap.get("jiage") == null ? "" : mmPinguiMap.get("jiage").toString();
                        String jiyao = mmPinguiMap.get("jiyao") == null ? "" : mmPinguiMap.get("jiyao").toString();
                        String yibao = mmPinguiMap.get("yibao") == null ? "" : mmPinguiMap.get("yibao").toString();
                        String yizhixingpingjia = mmPinguiMap.get("yizhixingpingjia") == null ? "" : mmPinguiMap.get("yizhixingpingjia").toString();
                        String shenqingkeshi = mmPinguiMap.get("shenqingkeshi") == null ? "" : mmPinguiMap.get("shenqingkeshi").toString();
                        String shenqingzongcishu = mmPinguiMap.get("shenqingzongcishu") == null ? "" : mmPinguiMap.get("shenqingzongcishu").toString();
                        String shenqingzongshuliang = mmPinguiMap.get("shenqingzongshuliang") == null ? "" : mmPinguiMap.get("shenqingzongshuliang").toString();
                        String beizhu = mmPinguiMap.get("beizhu") == null ? "" : mmPinguiMap.get("beizhu").toString();

                        String mmresult = mmPinguiMap.get("result") == null ? "" : mmPinguiMap.get("result").toString();
                        String mmbiaojueren = mmPinguiMap.get("username") == null ? "" : mmPinguiMap.get("username").toString();
                        String mmyijian = "";
                        if ("1".equals(mmresult)) {
                            mmyijian = "同意";
                        } else if ("0".equals(mmresult)) {
                            mmyijian = "不同意";
                        } else {
                            mmyijian = "不同意";
                        }
                        wsheet.addCell(new Label(1, mmpinpaiKaishihang, chanpinbianma, wcfFC));
                        wsheet.addCell(new Label(2, mmpinpaiKaishihang, yaopinmingcheng, wcfFC));
                        wsheet.addCell(new Label(3, mmpinpaiKaishihang, guige, wcfFC));
                        wsheet.addCell(new Label(4, mmpinpaiKaishihang, danwei, wcfFC));
                        wsheet.addCell(new Label(5, mmpinpaiKaishihang, jixing, wcfFC));
                        wsheet.addCell(new Label(6, mmpinpaiKaishihang, shengchanqiye, wcfFC));
                        wsheet.addCell(new Label(7, mmpinpaiKaishihang, jiage, wcfFC));
                        wsheet.addCell(new Label(8, mmpinpaiKaishihang, jiyao, wcfFC));
                        wsheet.addCell(new Label(9, mmpinpaiKaishihang, yibao, wcfFC));
                        wsheet.addCell(new Label(10, mmpinpaiKaishihang, yizhixingpingjia, wcfFC));
                        wsheet.addCell(new Label(11, mmpinpaiKaishihang, shenqingkeshi, wcfFC));
                        wsheet.addCell(new Label(12, mmpinpaiKaishihang, shenqingzongcishu, wcfFC));
                        wsheet.addCell(new Label(13, mmpinpaiKaishihang, shenqingzongshuliang, wcfFC));
                        wsheet.addCell(new Label(14, mmpinpaiKaishihang, beizhu, wcfFC));
                        wsheet.addCell(new Label(15, mmpinpaiKaishihang, mmyijian, wcfFC));
                        mmpinpaiKaishihang = mmpinpaiKaishihang + 1;
                    }
                }
                wsheet.addCell(new Label(0, mmpinzhongKaishihang, mmPinzhongOne, wcfFC));
                wsheet.mergeCells(0, mmpinzhongKaishihang, 0, mmpinzhongKaishihang + mmHebingshu);
                mmpinzhongKaishihang = mmpinzhongKaishihang + mmHebingshu + 1;

            }
            wbook.write(); // 写入文件
            wbook.close();
        } catch (Exception ex) {
            ex.printStackTrace();
        } finally {
            if (os != null) {
                try {
                    os.close();
                } catch (IOException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }
            }
        }
    }

    public void daochuqianzibiao46(@RequestParam("xiangmuid") String ppxiangmuid,
                                   @RequestParam("userid") String ppuserid,
                                   HttpServletRequest request, HttpServletResponse response) {

        response.reset();
        response.setContentType("application/x-download;charset=utf-8");
        List<Map<String, Object>> mmList = fujianslMapper.selectPingui(ppxiangmuid, 0, Integer.MAX_VALUE);
        Ysuser mmuser = ddYsuserService.findOne(ppuserid);
        String xiangmumingcheng = ysxiangmuService.findOne(ppxiangmuid).getXiangmuname();
        String mmusername = mmuser.getUsername();
        OutputStream os = null;
        WritableWorkbook wbook = null;
        try {
            os = new BufferedOutputStream(response.getOutputStream());//得到输出流的语句
            //response.getOutputStream();// 取得输出流
            response.reset();// 清空输出流
            SimpleDateFormat mmDateFormat = new SimpleDateFormat("yyyyMMdd-HHmmss");
            String wenjiantitle = xiangmumingcheng + mmusername + "委员结果表" + StringHandle.tiemString(); //文件名
            String tmptitle = xiangmumingcheng+"（" + mmusername + "）"; // 标题
            response.setHeader("Content-disposition", "attachment; filename=" + new String(wenjiantitle.getBytes(), "iso8859-1") + ".xls");// 设定输出文件头
            response.setContentType("application/vnd.ms-excel");// 定义输出类型
            wbook = Workbook.createWorkbook(os); // 建立excel文件
            WritableSheet wsheet = wbook.createSheet(tmptitle, 0); // sheet名称
            SheetSettings settings = wsheet.getSettings();
            settings.setProtected(true);
            /*  settings.setPassword("0000");*/
            // 设置excel标题
            WritableFont wfont = new WritableFont(WritableFont.ARIAL, 16, WritableFont.BOLD, false, UnderlineStyle.NO_UNDERLINE, Colour.BLACK); //设置表格样式

            WritableCellFormat wcfFC = new WritableCellFormat(wfont);
            wcfFC.setBorder(jxl.format.Border.ALL, jxl.format.BorderLineStyle.THIN); // 添加边框
            wcfFC.setVerticalAlignment(VerticalAlignment.CENTRE);   //设置居中对齐
            wcfFC.setAlignment(Alignment.CENTRE);

            WritableCellFormat wcfFC3 = new WritableCellFormat(wfont);
            wcfFC3.setVerticalAlignment(VerticalAlignment.CENTRE);   //设置居中对齐
            wcfFC3.setAlignment(Alignment.CENTRE);
            //wcfFC.setBackground(Colour.AQUA);
            Label label = new Label(0, 0, tmptitle, wcfFC3);

            WritableCellFormat cellFormat = new WritableCellFormat();
            cellFormat.setAlignment(jxl.format.Alignment.CENTRE);
            cellFormat.setVerticalAlignment(jxl.format.VerticalAlignment.CENTRE);
            cellFormat.setWrap(true);
            //cellFormat.setBackground(Colour.AQUA);
            cellFormat.setFont(wfont);
            label.setCellFormat(cellFormat);
            wsheet.addCell(label);
            wsheet.addCell(new Label(0, 0, tmptitle, wcfFC3));
            /*wsheet.addCell(new Label(7, 0, tmptitle, wcfFC));*/
            wsheet.setRowView(0, 600); //第一行高度
            wsheet.setRowView(1, 600); //第二行高度
            wsheet.mergeCells(0, 0, 8, 0);  //合并单元格(第一列的第一行和第十三列的第一行合并)
            wsheet.setColumnView(0, 9); //宽度
            wsheet.setColumnView(1, 32); //宽度
            wsheet.setColumnView(2, 9); //药品名称宽度
            wsheet.setColumnView(3, 16); //分类宽度
            wsheet.setColumnView(4, 20); //规格宽度
            wsheet.setColumnView(5, 22); //单位宽度
            wsheet.setColumnView(6, 17); //医保宽度
            wsheet.setColumnView(7, 8); //宽度
            wsheet.setColumnView(8, 20); //宽度


            // 开始生成主体内容
            wfont = new jxl.write.WritableFont(WritableFont.ARIAL, 10, WritableFont.BOLD, false, UnderlineStyle.NO_UNDERLINE, Colour.BLACK);
            wcfFC = new WritableCellFormat(wfont);
            wcfFC.setBorder(jxl.format.Border.ALL, jxl.format.BorderLineStyle.THIN);
            wcfFC.setVerticalAlignment(VerticalAlignment.CENTRE);   //设置居中对齐
            wcfFC.setAlignment(Alignment.CENTRE);
            wcfFC.setWrap(true);
            // 不需要边框和居中的样式
            WritableFont wfont2 = new WritableFont(WritableFont.ARIAL, 12, WritableFont.BOLD, false, UnderlineStyle.NO_UNDERLINE, Colour.BLACK); //设置表格样式
            WritableCellFormat wcfFC2 = new WritableCellFormat(wfont2);
            wcfFC2.setVerticalAlignment(jxl.format.VerticalAlignment.CENTRE);// 垂直居中
            wcfFC2 = new WritableCellFormat(wfont2);
            wcfFC2.setWrap(true);
            //  在  1 列  2 行 写入内容
            wsheet.addCell(new Label(0, 1, "投票人(签字):投票内容已核对无误。" + mmusername, wcfFC2));
            // 把  0 列 2 行 到 9 列 2 行合并
            wsheet.mergeCells(0, 1, 4, 1);


            wsheet.addCell(new Label(5, 1, "投票日期:" + StringHandle.shorttiemString(), wcfFC2));
            wsheet.mergeCells(5, 1, 8, 1);

            // 第三行 内容
            wsheet.addCell(new Label(0, 2, "序号", wcfFC));
            wsheet.addCell(new Label(1, 2, "药品名称", wcfFC));
            wsheet.addCell(new Label(2, 2, "医保", wcfFC));
            wsheet.addCell(new Label(3, 2, "是否为新增品种", wcfFC));
            wsheet.addCell(new Label(4, 2, "是否与集采药品重合", wcfFC));
            wsheet.addCell(new Label(5, 2, "是否与基本药品目录单方制剂重合", wcfFC));
            wsheet.addCell(new Label(6, 2, "协议效期", wcfFC));
            wsheet.addCell(new Label(7, 2, "备注", wcfFC));
            wsheet.addCell(new Label(8, 2, "表决意见（不纳入)", wcfFC));


            // 表头结束

            wfont = new jxl.write.WritableFont(WritableFont.ARIAL, 10, WritableFont.NO_BOLD, false, UnderlineStyle.NO_UNDERLINE, Colour.BLACK);
            wcfFC = new WritableCellFormat(wfont);
            wcfFC.setBorder(jxl.format.Border.ALL, jxl.format.BorderLineStyle.THIN);
            wcfFC.setVerticalAlignment(VerticalAlignment.CENTRE);   //设置居中对齐
            wcfFC.setAlignment(Alignment.CENTRE);
            wcfFC.setWrap(true);

            int count = mmList.size();
            int mmpinzhongKaishihang = 3;
            int mmpinpaiKaishihang = 3;


            for (int i = 0; i < count; i++) {
                Map<String, Object> mmPinzhongMap = mmList.get(i);

                String mmPinzhongOne = mmPinzhongMap.get("xuhao") == null ? "" : mmPinzhongMap.get("xuhao").toString();
                int mmHebingshu = 0;

                List<Map<String, Object>> mmPinguilist = fujianslMapper.findShengchanqiyeByPinguiResult(ppxiangmuid, mmPinzhongOne, ppuserid);
                if (mmPinguilist.size() > 0) {
                    mmHebingshu = mmPinguilist.size() - 1;
                }
                for (int j = 0; j < mmPinguilist.size(); j++) {
                    Map<String, Object> mmPinguiMap = mmPinguilist.get(j);
                    if (mmPinguiMap != null) {

                        String yaopinmingcheng = mmPinguiMap.get("yaopinmingcheng") == null ? "" : mmPinguiMap.get("yaopinmingcheng").toString();
                        String yibao = mmPinguiMap.get("yibao") == null ? "" : mmPinguiMap.get("yibao").toString();
                        String shifouxinzengpinzhong = mmPinguiMap.get("shifouxinzengpinzhong") == null ? "" : mmPinguiMap.get("shifouxinzengpinzhong").toString();
                        String shifoujicaichonghe = mmPinguiMap.get("shifoujicaichonghe") == null ? "" : mmPinguiMap.get("shifoujicaichonghe").toString();
                        String shifoujibenchonghe = mmPinguiMap.get("shifoujibenchonghe") == null ? "" : mmPinguiMap.get("shifoujibenchonghe").toString();
                        String xieyixiaoqi = mmPinguiMap.get("xieyixiaoqi") == null ? "" : mmPinguiMap.get("xieyixiaoqi").toString();
                        String beizhu = mmPinguiMap.get("beizhu") == null ? "" : mmPinguiMap.get("beizhu").toString();

                        String mmresult = mmPinguiMap.get("result") == null ? "" : mmPinguiMap.get("result").toString();
                        String mmbiaojueren = mmPinguiMap.get("username") == null ? "" : mmPinguiMap.get("username").toString();
                        String mmyijian = "";
                        if ("1".equals(mmresult)) {
                            mmyijian = "同意";
                        } else if ("0".equals(mmresult)) {
                            mmyijian = "不同意";
                        } else {
                            mmyijian = "不同意";
                        }

                        wsheet.addCell(new Label(1, mmpinpaiKaishihang, yaopinmingcheng, wcfFC));
                        wsheet.addCell(new Label(2, mmpinpaiKaishihang, yibao, wcfFC));
                        wsheet.addCell(new Label(3, mmpinpaiKaishihang, shifouxinzengpinzhong, wcfFC));
                        wsheet.addCell(new Label(4, mmpinpaiKaishihang, shifoujicaichonghe, wcfFC));
                        wsheet.addCell(new Label(5, mmpinpaiKaishihang, shifoujibenchonghe, wcfFC));
                        wsheet.addCell(new Label(6, mmpinpaiKaishihang, xieyixiaoqi, wcfFC));
                        wsheet.addCell(new Label(7, mmpinpaiKaishihang, beizhu, wcfFC));
                        wsheet.addCell(new Label(8, mmpinpaiKaishihang, mmyijian, wcfFC));
                        mmpinpaiKaishihang = mmpinpaiKaishihang + 1;
                    }
                }
                wsheet.addCell(new Label(0, mmpinzhongKaishihang, mmPinzhongOne, wcfFC));
                wsheet.mergeCells(0, mmpinzhongKaishihang, 0, mmpinzhongKaishihang + mmHebingshu);
                mmpinzhongKaishihang = mmpinzhongKaishihang + mmHebingshu + 1;

            }
            wbook.write(); // 写入文件
            wbook.close();
        } catch (Exception ex) {
            ex.printStackTrace();
        } finally {
            if (os != null) {
                try {
                    os.close();
                } catch (IOException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }
            }
        }
    }

    public void daochuqianzibiao5(@RequestParam("xiangmuid") String ppxiangmuid,
                                  @RequestParam("userid") String ppuserid,
                                  HttpServletRequest request, HttpServletResponse response) {

        response.reset();
        response.setContentType("application/x-download;charset=utf-8");
        List<Map<String, Object>> mmList = fujianwMapper.selectPingui(ppxiangmuid, 0, Integer.MAX_VALUE);
        Ysuser mmuser = ddYsuserService.findOne(ppuserid);
        String xiangmumingcheng = ysxiangmuService.findOne(ppxiangmuid).getXiangmuname();
        String mmusername = mmuser.getUsername();
        OutputStream os = null;
        WritableWorkbook wbook = null;
        try {
            os = new BufferedOutputStream(response.getOutputStream());//得到输出流的语句
            //response.getOutputStream();// 取得输出流
            response.reset();// 清空输出流
            SimpleDateFormat mmDateFormat = new SimpleDateFormat("yyyyMMdd-HHmmss");
            String wenjiantitle = xiangmumingcheng + mmusername + "委员结果表" + StringHandle.tiemString(); //文件名
            String tmptitle = xiangmumingcheng+"（" + mmusername + "）"; // 标题
            response.setHeader("Content-disposition", "attachment; filename=" + new String(wenjiantitle.getBytes(), "iso8859-1") + ".xls");// 设定输出文件头
            response.setContentType("application/vnd.ms-excel");// 定义输出类型
            wbook = Workbook.createWorkbook(os); // 建立excel文件
            WritableSheet wsheet = wbook.createSheet(tmptitle, 0); // sheet名称
            SheetSettings settings = wsheet.getSettings();
            settings.setProtected(true);
            /*  settings.setPassword("0000");*/
            // 设置excel标题
            WritableFont wfont = new WritableFont(WritableFont.ARIAL, 16, WritableFont.BOLD, false, UnderlineStyle.NO_UNDERLINE, Colour.BLACK); //设置表格样式

            WritableCellFormat wcfFC = new WritableCellFormat(wfont);
            wcfFC.setBorder(jxl.format.Border.ALL, jxl.format.BorderLineStyle.THIN); // 添加边框
            wcfFC.setVerticalAlignment(VerticalAlignment.CENTRE);   //设置居中对齐
            wcfFC.setAlignment(Alignment.CENTRE);

            WritableCellFormat wcfFC3 = new WritableCellFormat(wfont);
            wcfFC3.setVerticalAlignment(VerticalAlignment.CENTRE);   //设置居中对齐
            wcfFC3.setAlignment(Alignment.CENTRE);
            //wcfFC.setBackground(Colour.AQUA);
            Label label = new Label(0, 0, tmptitle, wcfFC3);

            WritableCellFormat cellFormat = new WritableCellFormat();
            cellFormat.setAlignment(jxl.format.Alignment.CENTRE);
            cellFormat.setVerticalAlignment(jxl.format.VerticalAlignment.CENTRE);
            cellFormat.setWrap(true);
            //cellFormat.setBackground(Colour.AQUA);
            cellFormat.setFont(wfont);
            label.setCellFormat(cellFormat);
            wsheet.addCell(label);
            wsheet.addCell(new Label(0, 0, tmptitle, wcfFC3));
            /*wsheet.addCell(new Label(7, 0, tmptitle, wcfFC));*/
            wsheet.setRowView(0, 600); //第一行高度
            wsheet.setRowView(1, 600); //第二行高度
            wsheet.mergeCells(0, 0, 13, 0);  //合并单元格(第一列的第一行和第十三列的第一行合并)
            wsheet.setColumnView(0, 10); //宽度
            wsheet.setColumnView(1, 15); //宽度
            wsheet.setColumnView(2, 17); //药品名称宽度
            wsheet.setColumnView(3, 9); //分类宽度
            wsheet.setColumnView(4, 9); //规格宽度
            wsheet.setColumnView(5, 9); //单位宽度
            wsheet.setColumnView(6, 17); //医保宽度
            wsheet.setColumnView(7, 9); //宽度
            wsheet.setColumnView(8, 9); //宽度
            wsheet.setColumnView(9, 9); //宽度
            wsheet.setColumnView(10, 18); //宽度
            wsheet.setColumnView(11, 16); //宽度
            wsheet.setColumnView(12, 10); //宽度
            wsheet.setColumnView(13, 15); //院本部宽度


            // 开始生成主体内容
            wfont = new jxl.write.WritableFont(WritableFont.ARIAL, 10, WritableFont.BOLD, false, UnderlineStyle.NO_UNDERLINE, Colour.BLACK);
            wcfFC = new WritableCellFormat(wfont);
            wcfFC.setBorder(jxl.format.Border.ALL, jxl.format.BorderLineStyle.THIN);
            wcfFC.setVerticalAlignment(VerticalAlignment.CENTRE);   //设置居中对齐
            wcfFC.setAlignment(Alignment.CENTRE);
            wcfFC.setWrap(true);
            // 不需要边框和居中的样式
            WritableFont wfont2 = new WritableFont(WritableFont.ARIAL, 12, WritableFont.BOLD, false, UnderlineStyle.NO_UNDERLINE, Colour.BLACK); //设置表格样式
            WritableCellFormat wcfFC2 = new WritableCellFormat(wfont2);
            wcfFC2.setVerticalAlignment(jxl.format.VerticalAlignment.CENTRE);// 垂直居中
            wcfFC2 = new WritableCellFormat(wfont2);
            wcfFC2.setWrap(true);
            //  在  1 列  2 行 写入内容
            wsheet.addCell(new Label(0, 1, "投票人(签字):投票内容已核对无误。" + mmusername, wcfFC2));
            // 把  0 列 2 行 到 9 列 2 行合并
            wsheet.mergeCells(0, 1, 8, 1);


            wsheet.addCell(new Label(9, 1, "投票日期:" + StringHandle.shorttiemString(), wcfFC2));
            wsheet.mergeCells(9, 1, 13, 1);

            // 第三行 内容
            wsheet.addCell(new Label(0, 2, "序号", wcfFC));
            wsheet.addCell(new Label(1, 2, "产品编码", wcfFC));
            wsheet.addCell(new Label(2, 2, "药品名称", wcfFC));
            wsheet.addCell(new Label(3, 2, "规格", wcfFC));
            wsheet.addCell(new Label(4, 2, "单位", wcfFC));
            wsheet.addCell(new Label(5, 2, "剂型", wcfFC));
            wsheet.addCell(new Label(6, 2, "生产企业", wcfFC));
            wsheet.addCell(new Label(7, 2, "价格（元）", wcfFC));
            wsheet.addCell(new Label(8, 2, "医保", wcfFC));
            wsheet.addCell(new Label(9, 2, "是否为新增品种", wcfFC));
            wsheet.addCell(new Label(10, 2, "是否与基本药品目录中通用名相同", wcfFC));
            wsheet.addCell(new Label(11, 2, "协议效期", wcfFC));
            wsheet.addCell(new Label(12, 2, "备注", wcfFC));
            wsheet.addCell(new Label(13, 2, "表决意见", wcfFC));


            // 表头结束

            wfont = new jxl.write.WritableFont(WritableFont.ARIAL, 10, WritableFont.NO_BOLD, false, UnderlineStyle.NO_UNDERLINE, Colour.BLACK);
            wcfFC = new WritableCellFormat(wfont);
            wcfFC.setBorder(jxl.format.Border.ALL, jxl.format.BorderLineStyle.THIN);
            wcfFC.setVerticalAlignment(VerticalAlignment.CENTRE);   //设置居中对齐
            wcfFC.setAlignment(Alignment.CENTRE);
            wcfFC.setWrap(true);

            int count = mmList.size();
            int mmpinzhongKaishihang = 3;
            int mmpinpaiKaishihang = 3;


            for (int i = 0; i < count; i++) {
                Map<String, Object> mmPinzhongMap = mmList.get(i);

                String mmPinzhongOne = mmPinzhongMap.get("xuhao") == null ? "" : mmPinzhongMap.get("xuhao").toString();
                int mmHebingshu = 0;

                List<Map<String, Object>> mmPinguilist = fujianwMapper.findShengchanqiyeByPinguiResult(ppxiangmuid, mmPinzhongOne, ppuserid);
                if (mmPinguilist.size() > 0) {
                    mmHebingshu = mmPinguilist.size() - 1;
                }
                for (int j = 0; j < mmPinguilist.size(); j++) {
                    Map<String, Object> mmPinguiMap = mmPinguilist.get(j);
                    if (mmPinguiMap != null) {
                        String chanpinbianma = mmPinguiMap.get("chanpinbianma") == null ? "" : mmPinguiMap.get("chanpinbianma").toString();
                        String yaopinmingcheng = mmPinguiMap.get("yaopinmingcheng") == null ? "" : mmPinguiMap.get("yaopinmingcheng").toString();
                        String guige = mmPinguiMap.get("guige") == null ? "" : mmPinguiMap.get("guige").toString();
                        String danwei = mmPinguiMap.get("danwei") == null ? "" : mmPinguiMap.get("danwei").toString();
                        String jixing = mmPinguiMap.get("jixing") == null ? "" : mmPinguiMap.get("jixing").toString();
                        String shengchanqiye = mmPinguiMap.get("shengchanqiye") == null ? "" : mmPinguiMap.get("shengchanqiye").toString();
                        String jiage = mmPinguiMap.get("jiage") == null ? "" : mmPinguiMap.get("jiage").toString();
                        String yibao = mmPinguiMap.get("yibao") == null ? "" : mmPinguiMap.get("yibao").toString();
                        String shifouxinzengpinzhong = mmPinguiMap.get("shifouxinzengpinzhong") == null ? "" : mmPinguiMap.get("shifouxinzengpinzhong").toString();
                        String shifoujibenxiangtong = mmPinguiMap.get("shifoujibenxiangtong") == null ? "" : mmPinguiMap.get("shifoujibenxiangtong").toString();
                        String xieyixiaoqi = mmPinguiMap.get("xieyixiaoqi") == null ? "" : mmPinguiMap.get("xieyixiaoqi").toString();
                        String beizhu = mmPinguiMap.get("beizhu") == null ? "" : mmPinguiMap.get("beizhu").toString();

                        String mmresult = mmPinguiMap.get("result") == null ? "" : mmPinguiMap.get("result").toString();
                        String mmbiaojueren = mmPinguiMap.get("username") == null ? "" : mmPinguiMap.get("username").toString();
                        String mmyijian = "";
                        if ("1".equals(mmresult)) {
                            mmyijian = "同意";
                        } else if ("0".equals(mmresult)) {
                            mmyijian = "不同意";
                        } else {
                            mmyijian = "不同意";
                        }
                        wsheet.setRowView(mmpinpaiKaishihang,700);
                        wsheet.addCell(new Label(1, mmpinpaiKaishihang, chanpinbianma, wcfFC));
                        wsheet.addCell(new Label(2, mmpinpaiKaishihang, yaopinmingcheng, wcfFC));
                        wsheet.addCell(new Label(3, mmpinpaiKaishihang, guige, wcfFC));
                        wsheet.addCell(new Label(4, mmpinpaiKaishihang, danwei, wcfFC));
                        wsheet.addCell(new Label(5, mmpinpaiKaishihang, jixing, wcfFC));
                        wsheet.addCell(new Label(6, mmpinpaiKaishihang, shengchanqiye, wcfFC));
                        wsheet.addCell(new Label(7, mmpinpaiKaishihang, jiage, wcfFC));
                        wsheet.addCell(new Label(8, mmpinpaiKaishihang, yibao, wcfFC));
                        wsheet.addCell(new Label(9, mmpinpaiKaishihang, shifouxinzengpinzhong, wcfFC));
                        wsheet.addCell(new Label(10, mmpinpaiKaishihang, shifoujibenxiangtong, wcfFC));
                        wsheet.addCell(new Label(11, mmpinpaiKaishihang, xieyixiaoqi, wcfFC));
                        wsheet.addCell(new Label(12, mmpinpaiKaishihang, beizhu, wcfFC));
                        wsheet.addCell(new Label(13, mmpinpaiKaishihang, mmyijian, wcfFC));
                        mmpinpaiKaishihang = mmpinpaiKaishihang + 1;
                    }
                }
                wsheet.addCell(new Label(0, mmpinzhongKaishihang, mmPinzhongOne, wcfFC));
                wsheet.mergeCells(0, mmpinzhongKaishihang, 0, mmpinzhongKaishihang + mmHebingshu);
                mmpinzhongKaishihang = mmpinzhongKaishihang + mmHebingshu + 1;

            }
            wbook.write(); // 写入文件
            wbook.close();
        } catch (Exception ex) {
            ex.printStackTrace();
        } finally {
            if (os != null) {
                try {
                    os.close();
                } catch (IOException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }
            }
        }
    }

    public void daochuqianzibiao7(@RequestParam("xiangmuid") String ppxiangmuid,
                                  @RequestParam("userid") String ppuserid,
                                  HttpServletRequest request, HttpServletResponse response) {

        response.reset();
        response.setContentType("application/x-download;charset=utf-8");
        List<Map<String, Object>> mmList = fujianqMapper.selectPingui(ppxiangmuid, 0, Integer.MAX_VALUE);
        String xiangmumingcheng = ysxiangmuService.findOne(ppxiangmuid).getXiangmuname();
        Ysuser mmuser = ddYsuserService.findOne(ppuserid);
        String mmusername = mmuser.getUsername();
        OutputStream os = null;
        WritableWorkbook wbook = null;
        try {
            os = new BufferedOutputStream(response.getOutputStream());//得到输出流的语句
            //response.getOutputStream();// 取得输出流
            response.reset();// 清空输出流
            SimpleDateFormat mmDateFormat = new SimpleDateFormat("yyyyMMdd-HHmmss");
            String wenjiantitle = xiangmumingcheng + mmusername + "委员结果表" + StringHandle.tiemString(); //文件名
            String tmptitle = xiangmumingcheng+"（" + mmusername + "）"; // 标题
            response.setHeader("Content-disposition", "attachment; filename=" + new String(wenjiantitle.getBytes(), "iso8859-1") + ".xls");// 设定输出文件头
            response.setContentType("application/vnd.ms-excel");// 定义输出类型
            wbook = Workbook.createWorkbook(os); // 建立excel文件
            WritableSheet wsheet = wbook.createSheet(tmptitle, 0); // sheet名称
            SheetSettings settings = wsheet.getSettings();
            settings.setProtected(true);
            /*  settings.setPassword("0000");*/
            // 设置excel标题
            WritableFont wfont = new WritableFont(WritableFont.ARIAL, 16, WritableFont.BOLD, false, UnderlineStyle.NO_UNDERLINE, Colour.BLACK); //设置表格样式

            WritableCellFormat wcfFC = new WritableCellFormat(wfont);
            wcfFC.setBorder(jxl.format.Border.ALL, jxl.format.BorderLineStyle.THIN); // 添加边框
            wcfFC.setVerticalAlignment(VerticalAlignment.CENTRE);   //设置居中对齐
            wcfFC.setAlignment(Alignment.CENTRE);

            WritableCellFormat wcfFC3 = new WritableCellFormat(wfont);
            wcfFC3.setVerticalAlignment(VerticalAlignment.CENTRE);   //设置居中对齐
            wcfFC3.setAlignment(Alignment.CENTRE);
            //wcfFC.setBackground(Colour.AQUA);
            Label label = new Label(0, 0, tmptitle, wcfFC3);

            WritableCellFormat cellFormat = new WritableCellFormat();
            cellFormat.setAlignment(jxl.format.Alignment.CENTRE);
            cellFormat.setVerticalAlignment(jxl.format.VerticalAlignment.CENTRE);
            cellFormat.setWrap(true);
            //cellFormat.setBackground(Colour.AQUA);
            cellFormat.setFont(wfont);
            label.setCellFormat(cellFormat);
            wsheet.addCell(label);
            wsheet.addCell(new Label(0, 0, tmptitle, wcfFC3));
            /*wsheet.addCell(new Label(7, 0, tmptitle, wcfFC));*/
            wsheet.setRowView(0, 600); //第一行高度
            wsheet.setRowView(1, 600); //第二行高度
            wsheet.mergeCells(0, 0, 12, 0);  //合并单元格(第一列的第一行和第十三列的第一行合并)
            wsheet.setColumnView(0, 9); //宽度
            wsheet.setColumnView(1, 15); //宽度
            wsheet.setColumnView(2, 15); //药品名称宽度
            wsheet.setColumnView(3, 9); //分类宽度
            wsheet.setColumnView(4, 9); //规格宽度
            wsheet.setColumnView(5, 9); //单位宽度
            wsheet.setColumnView(6, 23); //医保宽度
            wsheet.setColumnView(7, 9); //宽度
            wsheet.setColumnView(8, 9); //宽度
            wsheet.setColumnView(9, 9); //宽度
            wsheet.setColumnView(10, 9); //宽度
            wsheet.setColumnView(11, 9); //宽度
            wsheet.setColumnView(12, 13); //宽度


            // 开始生成主体内容
            wfont = new jxl.write.WritableFont(WritableFont.ARIAL, 10, WritableFont.BOLD, false, UnderlineStyle.NO_UNDERLINE, Colour.BLACK);
            wcfFC = new WritableCellFormat(wfont);
            wcfFC.setBorder(jxl.format.Border.ALL, jxl.format.BorderLineStyle.THIN);
            wcfFC.setVerticalAlignment(VerticalAlignment.CENTRE);   //设置居中对齐
            wcfFC.setAlignment(Alignment.CENTRE);
            wcfFC.setWrap(true);
            // 不需要边框和居中的样式
            WritableFont wfont2 = new WritableFont(WritableFont.ARIAL, 12, WritableFont.BOLD, false, UnderlineStyle.NO_UNDERLINE, Colour.BLACK); //设置表格样式
            WritableCellFormat wcfFC2 = new WritableCellFormat(wfont2);
            wcfFC2.setVerticalAlignment(jxl.format.VerticalAlignment.CENTRE);// 垂直居中
            wcfFC2 = new WritableCellFormat(wfont2);
            wcfFC2.setWrap(true);
            //  在  1 列  2 行 写入内容
            wsheet.addCell(new Label(0, 1, "投票人(签字):投票内容已核对无误。" + mmusername, wcfFC2));
            // 把  0 列 2 行 到 9 列 2 行合并
            wsheet.mergeCells(0, 1, 7, 1);


            wsheet.addCell(new Label(8, 1, "投票日期:" + StringHandle.shorttiemString(), wcfFC2));
            wsheet.mergeCells(8, 1, 12, 1);

            // 第三行 内容
            wsheet.addCell(new Label(0, 2, "序号", wcfFC));
            wsheet.addCell(new Label(1, 2, "产品编码", wcfFC));
            wsheet.addCell(new Label(2, 2, "药品名称", wcfFC));
            wsheet.addCell(new Label(3, 2, "规格", wcfFC));
            wsheet.addCell(new Label(4, 2, "单位", wcfFC));
            wsheet.addCell(new Label(5, 2, "剂型", wcfFC));
            wsheet.addCell(new Label(6, 2, "生产企业", wcfFC));
            wsheet.addCell(new Label(7, 2, "价格", wcfFC));
            wsheet.addCell(new Label(8, 2, "医保", wcfFC));
            wsheet.addCell(new Label(9, 2, "有无临床需求", wcfFC));
            wsheet.addCell(new Label(10, 2, "申请科室", wcfFC));
            wsheet.addCell(new Label(11, 2, "备注", wcfFC));
            wsheet.addCell(new Label(12, 2, "表决意见", wcfFC));


            // 表头结束

            wfont = new jxl.write.WritableFont(WritableFont.ARIAL, 10, WritableFont.NO_BOLD, false, UnderlineStyle.NO_UNDERLINE, Colour.BLACK);
            wcfFC = new WritableCellFormat(wfont);
            wcfFC.setBorder(jxl.format.Border.ALL, jxl.format.BorderLineStyle.THIN);
            wcfFC.setVerticalAlignment(VerticalAlignment.CENTRE);   //设置居中对齐
            wcfFC.setAlignment(Alignment.CENTRE);
            wcfFC.setWrap(true);

            int count = mmList.size();
            int mmpinzhongKaishihang = 3;
            int mmpinpaiKaishihang = 3;


            for (int i = 0; i < count; i++) {
                Map<String, Object> mmPinzhongMap = mmList.get(i);

                String mmPinzhongOne = mmPinzhongMap.get("xuhao") == null ? "" : mmPinzhongMap.get("xuhao").toString();
                int mmHebingshu = 0;

                List<Map<String, Object>> mmPinguilist = fujianqMapper.findShengchanqiyeByPinguiResult(ppxiangmuid, mmPinzhongOne, ppuserid);
                if (mmPinguilist.size() > 0) {
                    mmHebingshu = mmPinguilist.size() - 1;
                }
                for (int j = 0; j < mmPinguilist.size(); j++) {
                    Map<String, Object> mmPinguiMap = mmPinguilist.get(j);
                    if (mmPinguiMap != null) {
                        String chanpinbianma = mmPinguiMap.get("chanpinbianma") == null ? "" : mmPinguiMap.get("chanpinbianma").toString();
                        String yaopinmingcheng = mmPinguiMap.get("yaopinmingcheng") == null ? "" : mmPinguiMap.get("yaopinmingcheng").toString();
                        String guige = mmPinguiMap.get("guige") == null ? "" : mmPinguiMap.get("guige").toString();
                        String danwei = mmPinguiMap.get("danwei") == null ? "" : mmPinguiMap.get("danwei").toString();
                        String jixing = mmPinguiMap.get("jixing") == null ? "" : mmPinguiMap.get("jixing").toString();
                        String shengchanqiye = mmPinguiMap.get("shengchanqiye") == null ? "" : mmPinguiMap.get("shengchanqiye").toString();
                        String jiage = mmPinguiMap.get("jiage") == null ? "" : mmPinguiMap.get("jiage").toString();
                        String yibao = mmPinguiMap.get("yibao") == null ? "" : mmPinguiMap.get("yibao").toString();
                        String youwulinchuangxuqiu = mmPinguiMap.get("youwulinchuangxuqiu") == null ? "" : mmPinguiMap.get("youwulinchuangxuqiu").toString();
                        String shenqingkeshi = mmPinguiMap.get("shenqingkeshi") == null ? "" : mmPinguiMap.get("shenqingkeshi").toString();
                        String beizhu = mmPinguiMap.get("beizhu") == null ? "" : mmPinguiMap.get("beizhu").toString();

                        String mmresult = mmPinguiMap.get("result") == null ? "" : mmPinguiMap.get("result").toString();
                        String mmbiaojueren = mmPinguiMap.get("username") == null ? "" : mmPinguiMap.get("username").toString();
                        String mmyijian = "";
                        if ("1".equals(mmresult)) {
                            mmyijian = "同意";
                        } else if ("0".equals(mmresult)) {
                            mmyijian = "不同意";
                        } else {
                            mmyijian = "不同意";
                        }
                        wsheet.setRowView(mmpinpaiKaishihang,700);
                        wsheet.addCell(new Label(1, mmpinpaiKaishihang, chanpinbianma, wcfFC));
                        wsheet.addCell(new Label(2, mmpinpaiKaishihang, yaopinmingcheng, wcfFC));
                        wsheet.addCell(new Label(3, mmpinpaiKaishihang, guige, wcfFC));
                        wsheet.addCell(new Label(4, mmpinpaiKaishihang, danwei, wcfFC));
                        wsheet.addCell(new Label(5, mmpinpaiKaishihang, jixing, wcfFC));
                        wsheet.addCell(new Label(6, mmpinpaiKaishihang, shengchanqiye, wcfFC));
                        wsheet.addCell(new Label(7, mmpinpaiKaishihang, jiage, wcfFC));
                        wsheet.addCell(new Label(8, mmpinpaiKaishihang, yibao, wcfFC));
                        wsheet.addCell(new Label(9, mmpinpaiKaishihang, youwulinchuangxuqiu, wcfFC));
                        wsheet.addCell(new Label(10, mmpinpaiKaishihang, shenqingkeshi, wcfFC));
                        wsheet.addCell(new Label(11, mmpinpaiKaishihang, beizhu, wcfFC));
                        wsheet.addCell(new Label(12, mmpinpaiKaishihang, mmyijian, wcfFC));
                        mmpinpaiKaishihang = mmpinpaiKaishihang + 1;
                    }
                }
                wsheet.addCell(new Label(0, mmpinzhongKaishihang, mmPinzhongOne, wcfFC));
                wsheet.mergeCells(0, mmpinzhongKaishihang, 0, mmpinzhongKaishihang + mmHebingshu);
                mmpinzhongKaishihang = mmpinzhongKaishihang + mmHebingshu + 1;

            }
            wbook.write(); // 写入文件
            wbook.close();
        } catch (Exception ex) {
            ex.printStackTrace();
        } finally {
            if (os != null) {
                try {
                    os.close();
                } catch (IOException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }
            }
        }
    }

    public void daochuqianzibiao8(@RequestParam("xiangmuid") String ppxiangmuid,
                                  @RequestParam("userid") String ppuserid,
                                  HttpServletRequest request, HttpServletResponse response) {

        response.reset();
        response.setContentType("application/x-download;charset=utf-8");
        List<Map<String, Object>> mmList = fujianbMapper.selectPingui(ppxiangmuid, 0, Integer.MAX_VALUE);
        String xiangmumingcheng = ysxiangmuService.findOne(ppxiangmuid).getXiangmuname();
        Ysuser mmuser = ddYsuserService.findOne(ppuserid);
        String mmusername = mmuser.getUsername();
        OutputStream os = null;
        WritableWorkbook wbook = null;
        try {
            os = new BufferedOutputStream(response.getOutputStream());//得到输出流的语句
            //response.getOutputStream();// 取得输出流
            response.reset();// 清空输出流
            SimpleDateFormat mmDateFormat = new SimpleDateFormat("yyyyMMdd-HHmmss");
            String wenjiantitle = xiangmumingcheng + mmusername + "委员结果表" + StringHandle.tiemString(); //文件名
            String tmptitle = xiangmumingcheng+"（" + mmusername + "）"; // 标题
            response.setHeader("Content-disposition", "attachment; filename=" + new String(wenjiantitle.getBytes(), "iso8859-1") + ".xls");// 设定输出文件头
            response.setContentType("application/vnd.ms-excel");// 定义输出类型
            wbook = Workbook.createWorkbook(os); // 建立excel文件
            WritableSheet wsheet = wbook.createSheet(tmptitle, 0); // sheet名称
            SheetSettings settings = wsheet.getSettings();
            settings.setProtected(true);
            /*  settings.setPassword("0000");*/
            // 设置excel标题
            WritableFont wfont = new WritableFont(WritableFont.ARIAL, 16, WritableFont.BOLD, false, UnderlineStyle.NO_UNDERLINE, Colour.BLACK); //设置表格样式

            WritableCellFormat wcfFC = new WritableCellFormat(wfont);
            wcfFC.setBorder(jxl.format.Border.ALL, jxl.format.BorderLineStyle.THIN); // 添加边框
            wcfFC.setVerticalAlignment(VerticalAlignment.CENTRE);   //设置居中对齐
            wcfFC.setAlignment(Alignment.CENTRE);

            WritableCellFormat wcfFC3 = new WritableCellFormat(wfont);
            wcfFC3.setVerticalAlignment(VerticalAlignment.CENTRE);   //设置居中对齐
            wcfFC3.setAlignment(Alignment.CENTRE);
            //wcfFC.setBackground(Colour.AQUA);
            Label label = new Label(0, 0, tmptitle, wcfFC3);

            WritableCellFormat cellFormat = new WritableCellFormat();
            cellFormat.setAlignment(jxl.format.Alignment.CENTRE);
            cellFormat.setVerticalAlignment(jxl.format.VerticalAlignment.CENTRE);
            cellFormat.setWrap(true);
            //cellFormat.setBackground(Colour.AQUA);
            cellFormat.setFont(wfont);
            label.setCellFormat(cellFormat);
            wsheet.addCell(label);
            wsheet.addCell(new Label(0, 0, tmptitle, wcfFC3));
            /*wsheet.addCell(new Label(7, 0, tmptitle, wcfFC));*/
            wsheet.setRowView(0, 600); //第一行高度
            wsheet.setRowView(1, 600); //第二行高度
            wsheet.mergeCells(0, 0, 15, 0);  //合并单元格(第一列的第一行和第十三列的第一行合并)
            wsheet.setColumnView(0, 9); //宽度
            wsheet.setColumnView(1, 15); //宽度
            wsheet.setColumnView(2, 15); //药品名称宽度
            wsheet.setColumnView(3, 21); //分类宽度
            wsheet.setColumnView(4, 9); //规格宽度
            wsheet.setColumnView(5, 9); //单位宽度
            wsheet.setColumnView(6, 16); //医保宽度
            wsheet.setColumnView(7, 9); //宽度
            wsheet.setColumnView(8, 9); //宽度
            wsheet.setColumnView(9, 9); //宽度
            wsheet.setColumnView(10, 9); //宽度
            wsheet.setColumnView(11, 11); //宽度
            wsheet.setColumnView(12, 9); //宽度
            wsheet.setColumnView(13, 16); //宽度
            wsheet.setColumnView(14, 9); //宽度
            wsheet.setColumnView(15, 9); //宽度


            // 开始生成主体内容
            wfont = new jxl.write.WritableFont(WritableFont.ARIAL, 10, WritableFont.BOLD, false, UnderlineStyle.NO_UNDERLINE, Colour.BLACK);
            wcfFC = new WritableCellFormat(wfont);
            wcfFC.setBorder(jxl.format.Border.ALL, jxl.format.BorderLineStyle.THIN);
            wcfFC.setVerticalAlignment(VerticalAlignment.CENTRE);   //设置居中对齐
            wcfFC.setAlignment(Alignment.CENTRE);
            wcfFC.setWrap(true);
            // 不需要边框和居中的样式
            WritableFont wfont2 = new WritableFont(WritableFont.ARIAL, 12, WritableFont.BOLD, false, UnderlineStyle.NO_UNDERLINE, Colour.BLACK); //设置表格样式
            WritableCellFormat wcfFC2 = new WritableCellFormat(wfont2);
            wcfFC2.setVerticalAlignment(jxl.format.VerticalAlignment.CENTRE);// 垂直居中
            wcfFC2 = new WritableCellFormat(wfont2);
            wcfFC2.setWrap(true);
            //  在  1 列  2 行 写入内容
            wsheet.addCell(new Label(0, 1, "投票人(签字):投票内容已核对无误。" + mmusername, wcfFC2));
            // 把  0 列 2 行 到 9 列 2 行合并
            wsheet.mergeCells(0, 1, 10, 1);


            wsheet.addCell(new Label(11, 1, "投票日期:" + StringHandle.shorttiemString(), wcfFC2));
            wsheet.mergeCells(11, 1, 15, 1);

            // 第三行 内容
            wsheet.addCell(new Label(0, 2, "序号", wcfFC));
            wsheet.addCell(new Label(1, 2, "产品编码", wcfFC));
            wsheet.addCell(new Label(2, 2, "药品名称", wcfFC));
            wsheet.addCell(new Label(3, 2, "规格", wcfFC));
            wsheet.addCell(new Label(4, 2, "单位", wcfFC));
            wsheet.addCell(new Label(5, 2, "剂型", wcfFC));
            wsheet.addCell(new Label(6, 2, "生产企业", wcfFC));
            wsheet.addCell(new Label(7, 2, "价格（元）", wcfFC));
            wsheet.addCell(new Label(8, 2, "医保", wcfFC));
            wsheet.addCell(new Label(9, 2, "是否为新增品种", wcfFC));
            wsheet.addCell(new Label(10, 2, "有无临床需求", wcfFC));
            wsheet.addCell(new Label(11, 2, "申请科室", wcfFC));
            wsheet.addCell(new Label(12, 2, "有无同功效品种", wcfFC));
            wsheet.addCell(new Label(13, 2, "预选会意见", wcfFC));
            wsheet.addCell(new Label(14, 2, "备注", wcfFC));
            wsheet.addCell(new Label(15, 2, "表决意见", wcfFC));


            // 表头结束

            wfont = new jxl.write.WritableFont(WritableFont.ARIAL, 10, WritableFont.NO_BOLD, false, UnderlineStyle.NO_UNDERLINE, Colour.BLACK);
            wcfFC = new WritableCellFormat(wfont);
            wcfFC.setBorder(jxl.format.Border.ALL, jxl.format.BorderLineStyle.THIN);
            wcfFC.setVerticalAlignment(VerticalAlignment.CENTRE);   //设置居中对齐
            wcfFC.setAlignment(Alignment.CENTRE);
            wcfFC.setWrap(true);

            int count = mmList.size();
            int mmpinzhongKaishihang = 3;
            int mmpinpaiKaishihang = 3;


            for (int i = 0; i < count; i++) {
                Map<String, Object> mmPinzhongMap = mmList.get(i);

                String mmPinzhongOne = mmPinzhongMap.get("xuhao") == null ? "" : mmPinzhongMap.get("xuhao").toString();
                int mmHebingshu = 0;

                List<Map<String, Object>> mmPinguilist = fujianbMapper.findShengchanqiyeByPinguiResult(ppxiangmuid, mmPinzhongOne, ppuserid);
                if (mmPinguilist.size() > 0) {
                    mmHebingshu = mmPinguilist.size() - 1;
                }
                for (int j = 0; j < mmPinguilist.size(); j++) {
                    Map<String, Object> mmPinguiMap = mmPinguilist.get(j);
                    if (mmPinguiMap != null) {
                        String chanpinbianma = mmPinguiMap.get("chanpinbianma") == null ? "" : mmPinguiMap.get("chanpinbianma").toString();
                        String yaopinmingcheng = mmPinguiMap.get("yaopinmingcheng") == null ? "" : mmPinguiMap.get("yaopinmingcheng").toString();
                        String guige = mmPinguiMap.get("guige") == null ? "" : mmPinguiMap.get("guige").toString();
                        String danwei = mmPinguiMap.get("danwei") == null ? "" : mmPinguiMap.get("danwei").toString();
                        String jixing = mmPinguiMap.get("jixing") == null ? "" : mmPinguiMap.get("jixing").toString();
                        String shengchanqiye = mmPinguiMap.get("shengchanqiye") == null ? "" : mmPinguiMap.get("shengchanqiye").toString();
                        String jiage = mmPinguiMap.get("jiage") == null ? "" : mmPinguiMap.get("jiage").toString();
                        String yibao = mmPinguiMap.get("yibao") == null ? "" : mmPinguiMap.get("yibao").toString();
                        String shifouxinzengpinzhong = mmPinguiMap.get("shifouxinzengpinzhong") == null ? "" : mmPinguiMap.get("shifouxinzengpinzhong").toString();
                        String youwulinchuangxuqiu = mmPinguiMap.get("youwulinchuangxuqiu") == null ? "" : mmPinguiMap.get("youwulinchuangxuqiu").toString();
                        String youwutonggongxiao = mmPinguiMap.get("youwutonggongxiao") == null ? "" : mmPinguiMap.get("youwutonggongxiao").toString();
                        String xieyixiaoqi = mmPinguiMap.get("xieyixiaoqi") == null ? "" : mmPinguiMap.get("xieyixiaoqi").toString();
                        String yuxuanhuiyijian = mmPinguiMap.get("yuxuanhuiyijian") == null ? "" : mmPinguiMap.get("yuxuanhuiyijian").toString();
                        String shenqingkeshi = mmPinguiMap.get("shenqingkeshi") == null ? "" : mmPinguiMap.get("shenqingkeshi").toString();
                        String beizhu = mmPinguiMap.get("beizhu") == null ? "" : mmPinguiMap.get("beizhu").toString();

                        String mmresult = mmPinguiMap.get("result") == null ? "" : mmPinguiMap.get("result").toString();
                        String mmbiaojueren = mmPinguiMap.get("username") == null ? "" : mmPinguiMap.get("username").toString();
                        String mmyijian = "";
                        if ("1".equals(mmresult)) {
                            mmyijian = "同意";
                        } else if ("0".equals(mmresult)) {
                            mmyijian = "不同意";
                        } else {
                            mmyijian = "不同意";
                        }
                        wsheet.setRowView(mmpinpaiKaishihang,700);
                        wsheet.addCell(new Label(1, mmpinpaiKaishihang, chanpinbianma, wcfFC));
                        wsheet.addCell(new Label(2, mmpinpaiKaishihang, yaopinmingcheng, wcfFC));
                        wsheet.addCell(new Label(3, mmpinpaiKaishihang, guige, wcfFC));
                        wsheet.addCell(new Label(4, mmpinpaiKaishihang, danwei, wcfFC));
                        wsheet.addCell(new Label(5, mmpinpaiKaishihang, jixing, wcfFC));
                        wsheet.addCell(new Label(6, mmpinpaiKaishihang, shengchanqiye, wcfFC));
                        wsheet.addCell(new Label(7, mmpinpaiKaishihang, jiage, wcfFC));
                        wsheet.addCell(new Label(8, mmpinpaiKaishihang, yibao, wcfFC));
                        wsheet.addCell(new Label(9, mmpinpaiKaishihang, shifouxinzengpinzhong, wcfFC));
                        wsheet.addCell(new Label(10, mmpinpaiKaishihang, youwulinchuangxuqiu, wcfFC));
                        wsheet.addCell(new Label(11, mmpinpaiKaishihang, shenqingkeshi, wcfFC));
                        wsheet.addCell(new Label(12, mmpinpaiKaishihang, youwutonggongxiao, wcfFC));
                        wsheet.addCell(new Label(13, mmpinpaiKaishihang, yuxuanhuiyijian, wcfFC));
                        wsheet.addCell(new Label(14, mmpinpaiKaishihang, beizhu, wcfFC));
                        wsheet.addCell(new Label(15, mmpinpaiKaishihang, mmyijian, wcfFC));
                        mmpinpaiKaishihang = mmpinpaiKaishihang + 1;
                    }
                }
                wsheet.addCell(new Label(0, mmpinzhongKaishihang, mmPinzhongOne, wcfFC));
                wsheet.mergeCells(0, mmpinzhongKaishihang, 0, mmpinzhongKaishihang + mmHebingshu);
                mmpinzhongKaishihang = mmpinzhongKaishihang + mmHebingshu + 1;

            }
            wbook.write(); // 写入文件
            wbook.close();
        } catch (Exception ex) {
            ex.printStackTrace();
        } finally {
            if (os != null) {
                try {
                    os.close();
                } catch (IOException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }
            }
        }
    }

    public void daochuqianzibiao910(@RequestParam("xiangmuid") String ppxiangmuid,
                                    @RequestParam("userid") String ppuserid,
                                    HttpServletRequest request, HttpServletResponse response) {

        response.reset();
        response.setContentType("application/x-download;charset=utf-8");
        List<Map<String, Object>> mmList = fujianjsMapper.selectPingui(ppxiangmuid, 0, Integer.MAX_VALUE);
        String xiangmumingcheng = ysxiangmuService.findOne(ppxiangmuid).getXiangmuname();
        Ysuser mmuser = ddYsuserService.findOne(ppuserid);
        String mmusername = mmuser.getUsername();
        OutputStream os = null;
        WritableWorkbook wbook = null;
        try {
            os = new BufferedOutputStream(response.getOutputStream());//得到输出流的语句
            //response.getOutputStream();// 取得输出流
            response.reset();// 清空输出流
            SimpleDateFormat mmDateFormat = new SimpleDateFormat("yyyyMMdd-HHmmss");
            String wenjiantitle = xiangmumingcheng + mmusername + "委员结果表" + StringHandle.tiemString(); //文件名
            String tmptitle = xiangmumingcheng+"（" + mmusername + "）"; // 标题
            response.setHeader("Content-disposition", "attachment; filename=" + new String(wenjiantitle.getBytes(), "iso8859-1") + ".xls");// 设定输出文件头
            response.setContentType("application/vnd.ms-excel");// 定义输出类型
            wbook = Workbook.createWorkbook(os); // 建立excel文件
            WritableSheet wsheet = wbook.createSheet(tmptitle, 0); // sheet名称
            SheetSettings settings = wsheet.getSettings();
            settings.setProtected(true);
            /*  settings.setPassword("0000");*/
            // 设置excel标题
            WritableFont wfont = new WritableFont(WritableFont.ARIAL, 16, WritableFont.BOLD, false, UnderlineStyle.NO_UNDERLINE, Colour.BLACK); //设置表格样式

            WritableCellFormat wcfFC = new WritableCellFormat(wfont);
            wcfFC.setBorder(jxl.format.Border.ALL, jxl.format.BorderLineStyle.THIN); // 添加边框
            wcfFC.setVerticalAlignment(VerticalAlignment.CENTRE);   //设置居中对齐
            wcfFC.setAlignment(Alignment.CENTRE);

            WritableCellFormat wcfFC3 = new WritableCellFormat(wfont);
            wcfFC3.setVerticalAlignment(VerticalAlignment.CENTRE);   //设置居中对齐
            wcfFC3.setAlignment(Alignment.CENTRE);
            //wcfFC.setBackground(Colour.AQUA);
            Label label = new Label(0, 0, tmptitle, wcfFC3);

            WritableCellFormat cellFormat = new WritableCellFormat();
            cellFormat.setAlignment(jxl.format.Alignment.CENTRE);
            cellFormat.setVerticalAlignment(jxl.format.VerticalAlignment.CENTRE);
            cellFormat.setWrap(true);
            //cellFormat.setBackground(Colour.AQUA);
            cellFormat.setFont(wfont);
            label.setCellFormat(cellFormat);
            wsheet.addCell(label);
            wsheet.addCell(new Label(0, 0, tmptitle, wcfFC3));
            /*wsheet.addCell(new Label(7, 0, tmptitle, wcfFC));*/
            wsheet.setRowView(0, 600); //第一行高度
            wsheet.setRowView(1, 600); //第二行高度
            wsheet.mergeCells(0, 0, 12, 0);  //合并单元格(第一列的第一行和第十三列的第一行合并)
            wsheet.setColumnView(0, 9); //宽度
            wsheet.setColumnView(1, 17); //宽度
            wsheet.setColumnView(2, 21); //药品名称宽度
            wsheet.setColumnView(3, 23); //分类宽度
            wsheet.setColumnView(4, 5); //规格宽度
            wsheet.setColumnView(5, 14); //单位宽度
            wsheet.setColumnView(6, 20); //医保宽度
            wsheet.setColumnView(7, 9); //宽度
            wsheet.setColumnView(8, 9); //宽度
            wsheet.setColumnView(9, 9); //宽度
            wsheet.setColumnView(10, 11); //宽度
            wsheet.setColumnView(11, 9); //宽度
            wsheet.setColumnView(12, 9); //宽度


            // 开始生成主体内容
            wfont = new jxl.write.WritableFont(WritableFont.ARIAL, 10, WritableFont.BOLD, false, UnderlineStyle.NO_UNDERLINE, Colour.BLACK);
            wcfFC = new WritableCellFormat(wfont);
            wcfFC.setBorder(jxl.format.Border.ALL, jxl.format.BorderLineStyle.THIN);
            wcfFC.setVerticalAlignment(VerticalAlignment.CENTRE);   //设置居中对齐
            wcfFC.setAlignment(Alignment.CENTRE);
            wcfFC.setWrap(true);
            // 不需要边框和居中的样式
            WritableFont wfont2 = new WritableFont(WritableFont.ARIAL, 12, WritableFont.BOLD, false, UnderlineStyle.NO_UNDERLINE, Colour.BLACK); //设置表格样式
            WritableCellFormat wcfFC2 = new WritableCellFormat(wfont2);
            wcfFC2.setVerticalAlignment(jxl.format.VerticalAlignment.CENTRE);// 垂直居中
            wcfFC2 = new WritableCellFormat(wfont2);
            wcfFC2.setWrap(true);
            //  在  1 列  2 行 写入内容
            wsheet.addCell(new Label(0, 1, "投票人(签字):投票内容已核对无误。" + mmusername, wcfFC2));
            // 把  0 列 2 行 到 9 列 2 行合并
            wsheet.mergeCells(0, 1, 7, 1);


            wsheet.addCell(new Label(8, 1, "投票日期:" + StringHandle.shorttiemString(), wcfFC2));
            wsheet.mergeCells(8, 1, 12, 1);

            // 第三行 内容
            wsheet.addCell(new Label(0, 2, "序号", wcfFC));
            wsheet.addCell(new Label(1, 2, "产品编码", wcfFC));
            wsheet.addCell(new Label(2, 2, "药品名称", wcfFC));
            wsheet.addCell(new Label(3, 2, "规格", wcfFC));
            wsheet.addCell(new Label(4, 2, "单位", wcfFC));
            wsheet.addCell(new Label(5, 2, "剂型", wcfFC));
            wsheet.addCell(new Label(6, 2, "生产企业", wcfFC));
            wsheet.addCell(new Label(7, 2, "价格（元）", wcfFC));
            wsheet.addCell(new Label(8, 2, "医保", wcfFC));
            wsheet.addCell(new Label(9, 2, "采购任务（万元）", wcfFC));
            wsheet.addCell(new Label(10, 2, "协议效期", wcfFC));
            wsheet.addCell(new Label(11, 2, "备注", wcfFC));
            wsheet.addCell(new Label(12, 2, "表决意见", wcfFC));


            // 表头结束

            wfont = new jxl.write.WritableFont(WritableFont.ARIAL, 10, WritableFont.NO_BOLD, false, UnderlineStyle.NO_UNDERLINE, Colour.BLACK);
            wcfFC = new WritableCellFormat(wfont);
            wcfFC.setBorder(jxl.format.Border.ALL, jxl.format.BorderLineStyle.THIN);
            wcfFC.setVerticalAlignment(VerticalAlignment.CENTRE);   //设置居中对齐
            wcfFC.setAlignment(Alignment.CENTRE);
            wcfFC.setWrap(true);

            int count = mmList.size();
            int mmpinzhongKaishihang = 3;
            int mmpinpaiKaishihang = 3;


            for (int i = 0; i < count; i++) {
                Map<String, Object> mmPinzhongMap = mmList.get(i);

                String mmPinzhongOne = mmPinzhongMap.get("xuhao") == null ? "" : mmPinzhongMap.get("xuhao").toString();
                int mmHebingshu = 0;

                List<Map<String, Object>> mmPinguilist = fujianjsMapper.findShengchanqiyeByPinguiResult(ppxiangmuid, mmPinzhongOne, ppuserid);
                if (mmPinguilist.size() > 0) {
                    mmHebingshu = mmPinguilist.size() - 1;
                }
                for (int j = 0; j < mmPinguilist.size(); j++) {
                    Map<String, Object> mmPinguiMap = mmPinguilist.get(j);
                    if (mmPinguiMap != null) {
                        String chanpinbianma = mmPinguiMap.get("chanpinbianma") == null ? "" : mmPinguiMap.get("chanpinbianma").toString();
                        String yaopinmingcheng = mmPinguiMap.get("yaopinmingcheng") == null ? "" : mmPinguiMap.get("yaopinmingcheng").toString();
                        String guige = mmPinguiMap.get("guige") == null ? "" : mmPinguiMap.get("guige").toString();
                        String danwei = mmPinguiMap.get("danwei") == null ? "" : mmPinguiMap.get("danwei").toString();
                        String jixing = mmPinguiMap.get("jixing") == null ? "" : mmPinguiMap.get("jixing").toString();
                        String shengchanqiye = mmPinguiMap.get("shengchanqiye") == null ? "" : mmPinguiMap.get("shengchanqiye").toString();
                        String jiage = mmPinguiMap.get("jiage") == null ? "" : mmPinguiMap.get("jiage").toString();
                        String yibao = mmPinguiMap.get("yibao") == null ? "" : mmPinguiMap.get("yibao").toString();
                        String caigourenwu = mmPinguiMap.get("caigourenwu") == null ? "" : mmPinguiMap.get("caigourenwu").toString();
                        String xieyixiaoqi = mmPinguiMap.get("xieyixiaoqi") == null ? "" : mmPinguiMap.get("xieyixiaoqi").toString();
                        String beizhu = mmPinguiMap.get("beizhu") == null ? "" : mmPinguiMap.get("beizhu").toString();

                        String mmresult = mmPinguiMap.get("result") == null ? "" : mmPinguiMap.get("result").toString();
                        String mmbiaojueren = mmPinguiMap.get("username") == null ? "" : mmPinguiMap.get("username").toString();
                        String mmyijian = "";
                        if ("1".equals(mmresult)) {
                            mmyijian = "同意";
                        } else if ("0".equals(mmresult)) {
                            mmyijian = "不同意";
                        } else {
                            mmyijian = "不同意";
                        }
                        wsheet.setRowView(mmpinpaiKaishihang,700);
                        wsheet.addCell(new Label(1, mmpinpaiKaishihang, chanpinbianma, wcfFC));
                        wsheet.addCell(new Label(2, mmpinpaiKaishihang, yaopinmingcheng, wcfFC));
                        wsheet.addCell(new Label(3, mmpinpaiKaishihang, guige, wcfFC));
                        wsheet.addCell(new Label(4, mmpinpaiKaishihang, danwei, wcfFC));
                        wsheet.addCell(new Label(5, mmpinpaiKaishihang, jixing, wcfFC));
                        wsheet.addCell(new Label(6, mmpinpaiKaishihang, shengchanqiye, wcfFC));
                        wsheet.addCell(new Label(7, mmpinpaiKaishihang, jiage, wcfFC));
                        wsheet.addCell(new Label(8, mmpinpaiKaishihang, yibao, wcfFC));
                        wsheet.addCell(new Label(9, mmpinpaiKaishihang, caigourenwu, wcfFC));
                        wsheet.addCell(new Label(10, mmpinpaiKaishihang, xieyixiaoqi, wcfFC));
                        wsheet.addCell(new Label(11, mmpinpaiKaishihang, beizhu, wcfFC));
                        wsheet.addCell(new Label(12, mmpinpaiKaishihang, mmyijian, wcfFC));
                        mmpinpaiKaishihang = mmpinpaiKaishihang + 1;
                    }
                }
                wsheet.addCell(new Label(0, mmpinzhongKaishihang, mmPinzhongOne, wcfFC));
                wsheet.mergeCells(0, mmpinzhongKaishihang, 0, mmpinzhongKaishihang + mmHebingshu);
                mmpinzhongKaishihang = mmpinzhongKaishihang + mmHebingshu + 1;

            }
            wbook.write(); // 写入文件
            wbook.close();
        } catch (Exception ex) {
            ex.printStackTrace();
        } finally {
            if (os != null) {
                try {
                    os.close();
                } catch (IOException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }
            }
        }
    }

    public void daochuqianzibiao111213(@RequestParam("xiangmuid") String ppxiangmuid,
                                       @RequestParam("userid") String ppuserid,
                                       HttpServletRequest request, HttpServletResponse response) {

        response.reset();
        response.setContentType("application/x-download;charset=utf-8");
        List<Map<String, Object>> mmList = fujianjsMapper.selectPingui(ppxiangmuid, 0, Integer.MAX_VALUE);
        String xiangmumingcheng = ysxiangmuService.findOne(ppxiangmuid).getXiangmuname();
        Ysuser mmuser = ddYsuserService.findOne(ppuserid);
        String mmusername = mmuser.getUsername();
        OutputStream os = null;
        WritableWorkbook wbook = null;
        try {
            os = new BufferedOutputStream(response.getOutputStream());//得到输出流的语句
            //response.getOutputStream();// 取得输出流
            response.reset();// 清空输出流
            SimpleDateFormat mmDateFormat = new SimpleDateFormat("yyyyMMdd-HHmmss");
            String wenjiantitle = xiangmumingcheng + mmusername + "委员结果表" + StringHandle.tiemString(); //文件名
            String tmptitle = xiangmumingcheng+"（" + mmusername + "）"; // 标题
            response.setHeader("Content-disposition", "attachment; filename=" + new String(wenjiantitle.getBytes(), "iso8859-1") + ".xls");// 设定输出文件头
            response.setContentType("application/vnd.ms-excel");// 定义输出类型
            wbook = Workbook.createWorkbook(os); // 建立excel文件
            WritableSheet wsheet = wbook.createSheet(tmptitle, 0); // sheet名称
            SheetSettings settings = wsheet.getSettings();
            settings.setProtected(true);
            /*  settings.setPassword("0000");*/
            // 设置excel标题
            WritableFont wfont = new WritableFont(WritableFont.ARIAL, 16, WritableFont.BOLD, false, UnderlineStyle.NO_UNDERLINE, Colour.BLACK); //设置表格样式

            WritableCellFormat wcfFC = new WritableCellFormat(wfont);
            wcfFC.setBorder(jxl.format.Border.ALL, jxl.format.BorderLineStyle.THIN); // 添加边框
            wcfFC.setVerticalAlignment(VerticalAlignment.CENTRE);   //设置居中对齐
            wcfFC.setAlignment(Alignment.CENTRE);

            WritableCellFormat wcfFC3 = new WritableCellFormat(wfont);
            wcfFC3.setVerticalAlignment(VerticalAlignment.CENTRE);   //设置居中对齐
            wcfFC3.setAlignment(Alignment.CENTRE);
            //wcfFC.setBackground(Colour.AQUA);
            Label label = new Label(0, 0, tmptitle, wcfFC3);

            WritableCellFormat cellFormat = new WritableCellFormat();
            cellFormat.setAlignment(jxl.format.Alignment.CENTRE);
            cellFormat.setVerticalAlignment(jxl.format.VerticalAlignment.CENTRE);
            cellFormat.setWrap(true);
            //cellFormat.setBackground(Colour.AQUA);
            cellFormat.setFont(wfont);
            label.setCellFormat(cellFormat);
            wsheet.addCell(label);
            wsheet.addCell(new Label(0, 0, tmptitle, wcfFC3));
            /*wsheet.addCell(new Label(7, 0, tmptitle, wcfFC));*/
            wsheet.setRowView(0, 600); //第一行高度
            wsheet.setRowView(1, 600); //第二行高度
            wsheet.mergeCells(0, 0, 11, 0);  //合并单元格(第一列的第一行和第十三列的第一行合并)
            wsheet.setColumnView(0, 9); //宽度
            wsheet.setColumnView(1, 14); //宽度
            wsheet.setColumnView(2, 19); //药品名称宽度
            wsheet.setColumnView(3, 12); //分类宽度
            wsheet.setColumnView(4, 9); //规格宽度
            wsheet.setColumnView(5, 9); //单位宽度
            wsheet.setColumnView(6, 15); //医保宽度
            wsheet.setColumnView(7, 9); //宽度
            wsheet.setColumnView(8, 9); //宽度
            wsheet.setColumnView(9, 13); //宽度
            wsheet.setColumnView(10, 9); //宽度
            wsheet.setColumnView(11, 20); //宽度


            // 开始生成主体内容
            wfont = new jxl.write.WritableFont(WritableFont.ARIAL, 10, WritableFont.BOLD, false, UnderlineStyle.NO_UNDERLINE, Colour.BLACK);
            wcfFC = new WritableCellFormat(wfont);
            wcfFC.setBorder(jxl.format.Border.ALL, jxl.format.BorderLineStyle.THIN);
            wcfFC.setVerticalAlignment(VerticalAlignment.CENTRE);   //设置居中对齐
            wcfFC.setAlignment(Alignment.CENTRE);
            wcfFC.setWrap(true);
            // 不需要边框和居中的样式
            WritableFont wfont2 = new WritableFont(WritableFont.ARIAL, 12, WritableFont.BOLD, false, UnderlineStyle.NO_UNDERLINE, Colour.BLACK); //设置表格样式
            WritableCellFormat wcfFC2 = new WritableCellFormat(wfont2);
            wcfFC2.setVerticalAlignment(jxl.format.VerticalAlignment.CENTRE);// 垂直居中
            wcfFC2 = new WritableCellFormat(wfont2);
            wcfFC2.setWrap(true);
            //  在  1 列  2 行 写入内容
            wsheet.addCell(new Label(0, 1, "投票人(签字):投票内容已核对无误。" + mmusername, wcfFC2));
            // 把  0 列 2 行 到 9 列 2 行合并
            wsheet.mergeCells(0, 1, 6, 1);


            wsheet.addCell(new Label(7, 1, "投票日期:" + StringHandle.shorttiemString(), wcfFC2));
            wsheet.mergeCells(7, 1, 11, 1);

            // 第三行 内容
            wsheet.addCell(new Label(0, 2, "序号", wcfFC));
            wsheet.addCell(new Label(1, 2, "产品编码", wcfFC));
            wsheet.addCell(new Label(2, 2, "药品名称", wcfFC));
            wsheet.addCell(new Label(3, 2, "规格", wcfFC));
            wsheet.addCell(new Label(4, 2, "单位", wcfFC));
            wsheet.addCell(new Label(5, 2, "剂型", wcfFC));
            wsheet.addCell(new Label(6, 2, "生产企业", wcfFC));
            wsheet.addCell(new Label(7, 2, "价格", wcfFC));
            wsheet.addCell(new Label(8, 2, "医保", wcfFC));
            wsheet.addCell(new Label(9, 2, "采购任务量", wcfFC));
            wsheet.addCell(new Label(10, 2, "备注", wcfFC));
            wsheet.addCell(new Label(11, 2, "表决意见", wcfFC));


            // 表头结束

            wfont = new jxl.write.WritableFont(WritableFont.ARIAL, 10, WritableFont.NO_BOLD, false, UnderlineStyle.NO_UNDERLINE, Colour.BLACK);
            wcfFC = new WritableCellFormat(wfont);
            wcfFC.setBorder(jxl.format.Border.ALL, jxl.format.BorderLineStyle.THIN);
            wcfFC.setVerticalAlignment(VerticalAlignment.CENTRE);   //设置居中对齐
            wcfFC.setAlignment(Alignment.CENTRE);
            wcfFC.setWrap(true);

            int count = mmList.size();
            int mmpinzhongKaishihang = 3;
            int mmpinpaiKaishihang = 3;


            for (int i = 0; i < count; i++) {
                Map<String, Object> mmPinzhongMap = mmList.get(i);

                String mmPinzhongOne = mmPinzhongMap.get("xuhao") == null ? "" : mmPinzhongMap.get("xuhao").toString();
                int mmHebingshu = 0;

                List<Map<String, Object>> mmPinguilist = fujianjsMapper.findShengchanqiyeByPinguiResult(ppxiangmuid, mmPinzhongOne, ppuserid);
                if (mmPinguilist.size() > 0) {
                    mmHebingshu = mmPinguilist.size() - 1;
                }
                for (int j = 0; j < mmPinguilist.size(); j++) {
                    Map<String, Object> mmPinguiMap = mmPinguilist.get(j);
                    if (mmPinguiMap != null) {
                        String chanpinbianma = mmPinguiMap.get("chanpinbianma") == null ? "" : mmPinguiMap.get("chanpinbianma").toString();
                        String yaopinmingcheng = mmPinguiMap.get("yaopinmingcheng") == null ? "" : mmPinguiMap.get("yaopinmingcheng").toString();
                        String guige = mmPinguiMap.get("guige") == null ? "" : mmPinguiMap.get("guige").toString();
                        String danwei = mmPinguiMap.get("danwei") == null ? "" : mmPinguiMap.get("danwei").toString();
                        String jixing = mmPinguiMap.get("jixing") == null ? "" : mmPinguiMap.get("jixing").toString();
                        String shengchanqiye = mmPinguiMap.get("shengchanqiye") == null ? "" : mmPinguiMap.get("shengchanqiye").toString();
                        String jiage = mmPinguiMap.get("jiage") == null ? "" : mmPinguiMap.get("jiage").toString();
                        String yibao = mmPinguiMap.get("yibao") == null ? "" : mmPinguiMap.get("yibao").toString();
                        String caigourenwu = mmPinguiMap.get("caigourenwu") == null ? "" : mmPinguiMap.get("caigourenwu").toString();
                        String xieyixiaoqi = mmPinguiMap.get("xieyixiaoqi") == null ? "" : mmPinguiMap.get("xieyixiaoqi").toString();
                        String beizhu = mmPinguiMap.get("beizhu") == null ? "" : mmPinguiMap.get("beizhu").toString();

                        String mmresult = mmPinguiMap.get("result") == null ? "" : mmPinguiMap.get("result").toString();
                        String mmbiaojueren = mmPinguiMap.get("username") == null ? "" : mmPinguiMap.get("username").toString();
                        String mmyijian = "";
                        if ("1".equals(mmresult)) {
                            mmyijian = "同意";
                        } else if ("0".equals(mmresult)) {
                            mmyijian = "不同意";
                        } else {
                            mmyijian = "不同意";
                        }
                        wsheet.setRowView(mmpinpaiKaishihang,700);
                        wsheet.addCell(new Label(1, mmpinpaiKaishihang, chanpinbianma, wcfFC));
                        wsheet.addCell(new Label(2, mmpinpaiKaishihang, yaopinmingcheng, wcfFC));
                        wsheet.addCell(new Label(3, mmpinpaiKaishihang, guige, wcfFC));
                        wsheet.addCell(new Label(4, mmpinpaiKaishihang, danwei, wcfFC));
                        wsheet.addCell(new Label(5, mmpinpaiKaishihang, jixing, wcfFC));
                        wsheet.addCell(new Label(6, mmpinpaiKaishihang, shengchanqiye, wcfFC));
                        wsheet.addCell(new Label(7, mmpinpaiKaishihang, jiage, wcfFC));
                        wsheet.addCell(new Label(8, mmpinpaiKaishihang, yibao, wcfFC));
                        wsheet.addCell(new Label(9, mmpinpaiKaishihang, caigourenwu, wcfFC));
                        wsheet.addCell(new Label(10, mmpinpaiKaishihang, beizhu, wcfFC));
                        wsheet.addCell(new Label(11, mmpinpaiKaishihang, mmyijian, wcfFC));
                        mmpinpaiKaishihang = mmpinpaiKaishihang + 1;
                    }
                }
                wsheet.addCell(new Label(0, mmpinzhongKaishihang, mmPinzhongOne, wcfFC));
                wsheet.mergeCells(0, mmpinzhongKaishihang, 0, mmpinzhongKaishihang + mmHebingshu);
                mmpinzhongKaishihang = mmpinzhongKaishihang + mmHebingshu + 1;

            }
            wbook.write(); // 写入文件
            wbook.close();
        } catch (Exception ex) {
            ex.printStackTrace();
        } finally {
            if (os != null) {
                try {
                    os.close();
                } catch (IOException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }
            }
        }
    }

    public void daochuqianzibiao14tihuan(@RequestParam("xiangmuid") String ppxiangmuid,
                                         @RequestParam("userid") String ppuserid,
                                         HttpServletRequest request, HttpServletResponse response) {

        response.reset();
        response.setContentType("application/x-download;charset=utf-8");
        List<Map<String, Object>> mmList = fujiantihuanMapper.selectPingui(ppxiangmuid, 0, Integer.MAX_VALUE);
        String xiangmumingcheng = ysxiangmuService.findOne(ppxiangmuid).getXiangmuname();
        Ysuser mmuser = ddYsuserService.findOne(ppuserid);
        String mmusername = mmuser.getUsername();
        OutputStream os = null;
        WritableWorkbook wbook = null;
        try {
            os = new BufferedOutputStream(response.getOutputStream());//得到输出流的语句
            //response.getOutputStream();// 取得输出流
            response.reset();// 清空输出流
            SimpleDateFormat mmDateFormat = new SimpleDateFormat("yyyyMMdd-HHmmss");
            String wenjiantitle = xiangmumingcheng + mmusername + "委员结果表" + StringHandle.tiemString(); //文件名
            String tmptitle = xiangmumingcheng+"（" + mmusername + "）"; // 标题
            response.setHeader("Content-disposition", "attachment; filename=" + new String(wenjiantitle.getBytes(), "iso8859-1") + ".xls");// 设定输出文件头
            response.setContentType("application/vnd.ms-excel");// 定义输出类型
            wbook = Workbook.createWorkbook(os); // 建立excel文件
            WritableSheet wsheet = wbook.createSheet(tmptitle, 0); // sheet名称
            SheetSettings settings = wsheet.getSettings();
            settings.setProtected(true);
            /*  settings.setPassword("0000");*/
            // 设置excel标题
            WritableFont wfont = new WritableFont(WritableFont.ARIAL, 16, WritableFont.BOLD, false, UnderlineStyle.NO_UNDERLINE, Colour.BLACK); //设置表格样式

            WritableCellFormat wcfFC = new WritableCellFormat(wfont);
            wcfFC.setBorder(jxl.format.Border.ALL, jxl.format.BorderLineStyle.THIN); // 添加边框
            wcfFC.setVerticalAlignment(VerticalAlignment.CENTRE);   //设置居中对齐
            wcfFC.setAlignment(Alignment.CENTRE);

            WritableCellFormat wcfFC3 = new WritableCellFormat(wfont);
            wcfFC3.setVerticalAlignment(VerticalAlignment.CENTRE);   //设置居中对齐
            wcfFC3.setAlignment(Alignment.CENTRE);
            //wcfFC.setBackground(Colour.AQUA);
            Label label = new Label(0, 0, tmptitle, wcfFC3);

            WritableCellFormat cellFormat = new WritableCellFormat();
            cellFormat.setAlignment(jxl.format.Alignment.CENTRE);
            cellFormat.setVerticalAlignment(jxl.format.VerticalAlignment.CENTRE);
            cellFormat.setWrap(true);
            //cellFormat.setBackground(Colour.AQUA);
            cellFormat.setFont(wfont);
            label.setCellFormat(cellFormat);
            wsheet.addCell(label);
            wsheet.addCell(new Label(0, 0, tmptitle, wcfFC3));
            /*wsheet.addCell(new Label(7, 0, tmptitle, wcfFC));*/
            wsheet.setRowView(0, 600); //第一行高度
            wsheet.setRowView(1, 600); //第二行高度
            wsheet.mergeCells(0, 0, 18, 0);  //合并单元格(第一列的第一行和第十三列的第一行合并)
            wsheet.setColumnView(0, 9); //宽度
            wsheet.setColumnView(1, 14); //宽度
            wsheet.setColumnView(2, 9); //药品名称宽度
            wsheet.setColumnView(3, 9); //分类宽度
            wsheet.setColumnView(4, 9); //规格宽度
            wsheet.setColumnView(5, 9); //单位宽度
            wsheet.setColumnView(6, 14); //医保宽度
            wsheet.setColumnView(7, 9); //宽度
            wsheet.setColumnView(8, 9); //宽度
            wsheet.setColumnView(9, 14); //宽度
            wsheet.setColumnView(10, 10); //宽度
            wsheet.setColumnView(11, 9); //宽度
            wsheet.setColumnView(12, 9); //宽度
            wsheet.setColumnView(13, 9); //宽度
            wsheet.setColumnView(14, 14); //宽度
            wsheet.setColumnView(15, 9); //宽度
            wsheet.setColumnView(16, 9); //宽度
            wsheet.setColumnView(17, 9); //宽度
            wsheet.setColumnView(18, 9); //宽度



            // 开始生成主体内容
            wfont = new jxl.write.WritableFont(WritableFont.ARIAL, 10, WritableFont.BOLD, false, UnderlineStyle.NO_UNDERLINE, Colour.BLACK);
            wcfFC = new WritableCellFormat(wfont);
            wcfFC.setBorder(jxl.format.Border.ALL, jxl.format.BorderLineStyle.THIN);
            wcfFC.setVerticalAlignment(VerticalAlignment.CENTRE);   //设置居中对齐
            wcfFC.setAlignment(Alignment.CENTRE);
            wcfFC.setWrap(true);
            // 不需要边框和居中的样式
            WritableFont wfont2 = new WritableFont(WritableFont.ARIAL, 12, WritableFont.BOLD, false, UnderlineStyle.NO_UNDERLINE, Colour.BLACK); //设置表格样式
            WritableCellFormat wcfFC2 = new WritableCellFormat(wfont2);
            wcfFC2.setVerticalAlignment(jxl.format.VerticalAlignment.CENTRE);// 垂直居中
            wcfFC2 = new WritableCellFormat(wfont2);
            wcfFC2.setWrap(true);
            //  在  1 列  2 行 写入内容
            wsheet.addCell(new Label(0, 1, "投票人(签字):投票内容已核对无误。" + mmusername, wcfFC2));
            // 把  0 列 2 行 到 9 列 2 行合并
            wsheet.mergeCells(0, 1, 12, 1);


            wsheet.addCell(new Label(13, 1, "投票日期:" + StringHandle.shorttiemString(), wcfFC2));
            wsheet.mergeCells(13, 1, 18, 1);

            // 第三行 内容
            wsheet.addCell(new Label(0, 2, "序号", wcfFC));
            wsheet.mergeCells(0, 2, 0, 3);
            wsheet.addCell(new Label(1, 2, "产品编码", wcfFC));
            wsheet.mergeCells(1, 2, 1, 3);
            wsheet.addCell(new Label(2, 2, "药品名称", wcfFC));
            wsheet.mergeCells(2, 2, 2, 3);
            wsheet.addCell(new Label(3, 2, "现有目录品种(被替换)", wcfFC));
            wsheet.mergeCells(3, 2, 8, 2);
            wsheet.addCell(new Label(9, 2, "产品编码", wcfFC));
            wsheet.mergeCells(9, 2, 9, 3);
            wsheet.addCell(new Label(10, 2, "药品名称", wcfFC));
            wsheet.mergeCells(10, 2, 10, 3);
            wsheet.addCell(new Label(11, 2, "拟调整品种(替换)", wcfFC));
            wsheet.mergeCells(11, 2, 16, 2);
            wsheet.addCell(new Label(17, 2, "备注", wcfFC));
            wsheet.mergeCells(17, 2, 17, 3);
            wsheet.addCell(new Label(18, 2, "表决意见", wcfFC));
            wsheet.mergeCells(18, 2, 18, 3);

            wsheet.addCell(new Label(3, 3, "规格", wcfFC));
            wsheet.addCell(new Label(4, 3, "单位", wcfFC));
            wsheet.addCell(new Label(5, 3, "剂型", wcfFC));
            wsheet.addCell(new Label(6, 3, "生产企业", wcfFC));
            wsheet.addCell(new Label(7, 3, "价格", wcfFC));
            wsheet.addCell(new Label(8, 3, "医保", wcfFC));
            wsheet.addCell(new Label(11, 3, "规格", wcfFC));
            wsheet.addCell(new Label(12, 3, "单位", wcfFC));
            wsheet.addCell(new Label(13, 3, "剂型", wcfFC));
            wsheet.addCell(new Label(14, 3, "生产企业", wcfFC));
            wsheet.addCell(new Label(15, 3, "价格", wcfFC));
            wsheet.addCell(new Label(16, 3, "医保", wcfFC));
            // 表头结束

            wfont = new jxl.write.WritableFont(WritableFont.ARIAL, 10, WritableFont.NO_BOLD, false, UnderlineStyle.NO_UNDERLINE, Colour.BLACK);
            wcfFC = new WritableCellFormat(wfont);
            wcfFC.setBorder(jxl.format.Border.ALL, jxl.format.BorderLineStyle.THIN);
            wcfFC.setVerticalAlignment(VerticalAlignment.CENTRE);   //设置居中对齐
            wcfFC.setAlignment(Alignment.CENTRE);
            wcfFC.setWrap(true);

            int count = mmList.size();
            int mmpinzhongKaishihang = 4;
            int mmpinpaiKaishihang = 4;


            for (int i = 0; i < count; i++) {
                Map<String, Object> mmPinzhongMap = mmList.get(i);

                String mmPinzhongOne = mmPinzhongMap.get("xuhao") == null ? "" : mmPinzhongMap.get("xuhao").toString();
                int mmHebingshu = 0;

                List<Map<String, Object>> mmPinguilist = fujiantihuanMapper.findShengchanqiyeByPinguiResult(ppxiangmuid, mmPinzhongOne, ppuserid);
                if (mmPinguilist.size() > 0) {
                    mmHebingshu = mmPinguilist.size() - 1;
                }
                for (int j = 0; j < mmPinguilist.size(); j++) {
                    Map<String, Object> mmPinguiMap = mmPinguilist.get(j);
                    if (mmPinguiMap != null) {
                        String chanpinbianma = mmPinguiMap.get("chanpinbianma") == null ? "" : mmPinguiMap.get("chanpinbianma").toString();
                        String yaopinmingcheng = mmPinguiMap.get("yaopinmingcheng") == null ? "" : mmPinguiMap.get("yaopinmingcheng").toString();
                        String xyguige = mmPinguiMap.get("xyguige") == null ? "" : mmPinguiMap.get("xyguige").toString();
                        String xydanwei = mmPinguiMap.get("xydanwei") == null ? "" : mmPinguiMap.get("xydanwei").toString();
                        String xyjixing = mmPinguiMap.get("xyjixing") == null ? "" : mmPinguiMap.get("xyjixing").toString();
                        String xyshengchanqiye = mmPinguiMap.get("xyshengchanqiye") == null ? "" : mmPinguiMap.get("xyshengchanqiye").toString();
                        String xyjiage = mmPinguiMap.get("xyjiage") == null ? "" : mmPinguiMap.get("xyjiage").toString();
                        String xyyibao = mmPinguiMap.get("xyyibao") == null ? "" : mmPinguiMap.get("xyyibao").toString();
                        String tzguige = mmPinguiMap.get("tzguige") == null ? "" : mmPinguiMap.get("tzguige").toString();
                        String tzdanwei = mmPinguiMap.get("tzdanwei") == null ? "" : mmPinguiMap.get("tzdanwei").toString();
                        String tzjixing = mmPinguiMap.get("tzjixing") == null ? "" : mmPinguiMap.get("tzjixing").toString();
                        String tzshengchanqiye = mmPinguiMap.get("tzshengchanqiye") == null ? "" : mmPinguiMap.get("tzshengchanqiye").toString();
                        String tzjiage = mmPinguiMap.get("tzjiage") == null ? "" : mmPinguiMap.get("tzjiage").toString();
                        String tzyibao = mmPinguiMap.get("tzyibao") == null ? "" : mmPinguiMap.get("tzyibao").toString();
                        String caigourenwu = mmPinguiMap.get("caigourenwu") == null ? "" : mmPinguiMap.get("caigourenwu").toString();
                        String xieyixiaoqi = mmPinguiMap.get("xieyixiaoqi") == null ? "" : mmPinguiMap.get("xieyixiaoqi").toString();
                        String beizhu = mmPinguiMap.get("beizhu") == null ? "" : mmPinguiMap.get("beizhu").toString();
                        String chanpinbianma2 = mmPinguiMap.get("beuzhu1") == null ? "" : mmPinguiMap.get("beuzhu1").toString();
                        String yaopinmingcheng2 = mmPinguiMap.get("beizhu2") == null ? "" : mmPinguiMap.get("beizhu2").toString();

                        String mmresult = mmPinguiMap.get("result") == null ? "" : mmPinguiMap.get("result").toString();
                        String mmbiaojueren = mmPinguiMap.get("username") == null ? "" : mmPinguiMap.get("username").toString();
                        String mmyijian = "";
                        if ("1".equals(mmresult)) {
                            mmyijian = "同意";
                        } else if ("0".equals(mmresult)) {
                            mmyijian = "不同意";
                        } else {
                            mmyijian = "不同意";
                        }
                        wsheet.setRowView(mmpinpaiKaishihang,700);
                        wsheet.addCell(new Label(1, mmpinpaiKaishihang, chanpinbianma, wcfFC));
                        wsheet.addCell(new Label(2, mmpinpaiKaishihang, yaopinmingcheng, wcfFC));
                        wsheet.addCell(new Label(3, mmpinpaiKaishihang, xyguige, wcfFC));
                        wsheet.addCell(new Label(4, mmpinpaiKaishihang, xydanwei, wcfFC));
                        wsheet.addCell(new Label(5, mmpinpaiKaishihang, xyjixing, wcfFC));
                        wsheet.addCell(new Label(6, mmpinpaiKaishihang, xyshengchanqiye, wcfFC));
                        wsheet.addCell(new Label(7, mmpinpaiKaishihang, xyjiage, wcfFC));
                        wsheet.addCell(new Label(8, mmpinpaiKaishihang, xyyibao, wcfFC));
                        wsheet.addCell(new Label(9, mmpinpaiKaishihang, chanpinbianma2, wcfFC));
                        wsheet.addCell(new Label(10, mmpinpaiKaishihang, yaopinmingcheng2, wcfFC));
                        wsheet.addCell(new Label(11, mmpinpaiKaishihang, tzguige, wcfFC));
                        wsheet.addCell(new Label(12, mmpinpaiKaishihang, tzdanwei, wcfFC));
                        wsheet.addCell(new Label(13, mmpinpaiKaishihang, tzjixing, wcfFC));
                        wsheet.addCell(new Label(14, mmpinpaiKaishihang, tzshengchanqiye, wcfFC));
                        wsheet.addCell(new Label(15, mmpinpaiKaishihang, tzjiage, wcfFC));
                        wsheet.addCell(new Label(16, mmpinpaiKaishihang, tzyibao, wcfFC));
                        wsheet.addCell(new Label(17, mmpinpaiKaishihang, beizhu, wcfFC));
                        wsheet.addCell(new Label(18, mmpinpaiKaishihang, mmyijian, wcfFC));
                        mmpinpaiKaishihang = mmpinpaiKaishihang + 1;
                    }
                }
                wsheet.addCell(new Label(0, mmpinzhongKaishihang, mmPinzhongOne, wcfFC));
                wsheet.mergeCells(0, mmpinzhongKaishihang, 0, mmpinzhongKaishihang + mmHebingshu);
                mmpinzhongKaishihang = mmpinzhongKaishihang + mmHebingshu + 1;

            }
            wbook.write(); // 写入文件
            wbook.close();
        } catch (Exception ex) {
            ex.printStackTrace();
        } finally {
            if (os != null) {
                try {
                    os.close();
                } catch (IOException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }
            }
        }
    }

    public void daochuqianzibiao14yuanyan(@RequestParam("xiangmuid") String ppxiangmuid,
                                          @RequestParam("userid") String ppuserid,
                                          HttpServletRequest request, HttpServletResponse response) {

        response.reset();
        response.setContentType("application/x-download;charset=utf-8");
        List<Map<String, Object>> mmList = fujianyuanyanMapper.selectPingui(ppxiangmuid, 0, Integer.MAX_VALUE);
        String xiangmumingcheng = ysxiangmuService.findOne(ppxiangmuid).getXiangmuname();
        Ysuser mmuser = ddYsuserService.findOne(ppuserid);
        String mmusername = mmuser.getUsername();
        OutputStream os = null;
        WritableWorkbook wbook = null;
        try {
            os = new BufferedOutputStream(response.getOutputStream());//得到输出流的语句
            //response.getOutputStream();// 取得输出流
            response.reset();// 清空输出流
            SimpleDateFormat mmDateFormat = new SimpleDateFormat("yyyyMMdd-HHmmss");
            String wenjiantitle = xiangmumingcheng + mmusername + "委员结果表" + StringHandle.tiemString(); //文件名
            String tmptitle = xiangmumingcheng+"（" + mmusername + "）"; // 标题
            response.setHeader("Content-disposition", "attachment; filename=" + new String(wenjiantitle.getBytes(), "iso8859-1") + ".xls");// 设定输出文件头
            response.setContentType("application/vnd.ms-excel");// 定义输出类型
            wbook = Workbook.createWorkbook(os); // 建立excel文件
            WritableSheet wsheet = wbook.createSheet(tmptitle, 0); // sheet名称
            SheetSettings settings = wsheet.getSettings();
            settings.setProtected(true);
            /*  settings.setPassword("0000");*/
            // 设置excel标题
            WritableFont wfont = new WritableFont(WritableFont.ARIAL, 16, WritableFont.BOLD, false, UnderlineStyle.NO_UNDERLINE, Colour.BLACK); //设置表格样式

            WritableCellFormat wcfFC = new WritableCellFormat(wfont);
            wcfFC.setBorder(jxl.format.Border.ALL, jxl.format.BorderLineStyle.THIN); // 添加边框
            wcfFC.setVerticalAlignment(VerticalAlignment.CENTRE);   //设置居中对齐
            wcfFC.setAlignment(Alignment.CENTRE);

            WritableCellFormat wcfFC3 = new WritableCellFormat(wfont);
            wcfFC3.setVerticalAlignment(VerticalAlignment.CENTRE);   //设置居中对齐
            wcfFC3.setAlignment(Alignment.CENTRE);
            //wcfFC.setBackground(Colour.AQUA);
            Label label = new Label(0, 0, tmptitle, wcfFC3);

            WritableCellFormat cellFormat = new WritableCellFormat();
            cellFormat.setAlignment(jxl.format.Alignment.CENTRE);
            cellFormat.setVerticalAlignment(jxl.format.VerticalAlignment.CENTRE);
            cellFormat.setWrap(true);
            //cellFormat.setBackground(Colour.AQUA);
            cellFormat.setFont(wfont);
            label.setCellFormat(cellFormat);
            wsheet.addCell(label);
            wsheet.addCell(new Label(0, 0, tmptitle, wcfFC3));
            /*wsheet.addCell(new Label(7, 0, tmptitle, wcfFC));*/
            wsheet.setRowView(0, 600); //第一行高度
            wsheet.setRowView(1, 600); //第二行高度
            wsheet.mergeCells(0, 0, 11, 0);  //合并单元格(第一列的第一行和第十三列的第一行合并)
            wsheet.setColumnView(0, 14); //宽度
            wsheet.setColumnView(1, 14); //宽度
            wsheet.setColumnView(2, 14); //药品名称宽度
            wsheet.setColumnView(3, 14); //分类宽度
            wsheet.setColumnView(4, 14); //规格宽度
            wsheet.setColumnView(5, 14); //单位宽度
            wsheet.setColumnView(6, 14); //医保宽度
            wsheet.setColumnView(7, 14); //宽度
            wsheet.setColumnView(8, 14); //宽度
            wsheet.setColumnView(9, 14); //宽度
            wsheet.setColumnView(10, 14); //宽度
            wsheet.setColumnView(11, 14); //宽度


            // 开始生成主体内容
            wfont = new jxl.write.WritableFont(WritableFont.ARIAL, 10, WritableFont.BOLD, false, UnderlineStyle.NO_UNDERLINE, Colour.BLACK);
            wcfFC = new WritableCellFormat(wfont);
            wcfFC.setBorder(jxl.format.Border.ALL, jxl.format.BorderLineStyle.THIN);
            wcfFC.setVerticalAlignment(VerticalAlignment.CENTRE);   //设置居中对齐
            wcfFC.setAlignment(Alignment.CENTRE);
            wcfFC.setWrap(true);
            // 不需要边框和居中的样式
            WritableFont wfont2 = new WritableFont(WritableFont.ARIAL, 12, WritableFont.BOLD, false, UnderlineStyle.NO_UNDERLINE, Colour.BLACK); //设置表格样式
            WritableCellFormat wcfFC2 = new WritableCellFormat(wfont2);
            wcfFC2.setVerticalAlignment(jxl.format.VerticalAlignment.CENTRE);// 垂直居中
            wcfFC2 = new WritableCellFormat(wfont2);
            wcfFC2.setWrap(true);
            //  在  1 列  2 行 写入内容
            wsheet.addCell(new Label(0, 1, "投票人(签字):投票内容已核对无误。" + mmusername, wcfFC2));
            // 把  0 列 2 行 到 9 列 2 行合并
            wsheet.mergeCells(0, 1, 7, 1);


            wsheet.addCell(new Label(8, 1, "投票日期:" + StringHandle.shorttiemString(), wcfFC2));
            wsheet.mergeCells(8, 1, 11, 1);

            // 第三行 内容
            wsheet.addCell(new Label(0, 2, "序号", wcfFC));
            wsheet.addCell(new Label(1, 2, "产品编码", wcfFC));
            wsheet.addCell(new Label(2, 2, "药品名称", wcfFC));
            wsheet.addCell(new Label(3, 2, "规格", wcfFC));
            wsheet.addCell(new Label(4, 2, "单位", wcfFC));
            wsheet.addCell(new Label(5, 2, "剂型", wcfFC));
            wsheet.addCell(new Label(6, 2, "原研", wcfFC));
            wsheet.addCell(new Label(7, 2, "生产企业", wcfFC));
            wsheet.addCell(new Label(8, 2, "价格", wcfFC));
            wsheet.addCell(new Label(9, 2, "医保", wcfFC));
            wsheet.addCell(new Label(10, 2, "备注", wcfFC));
            wsheet.addCell(new Label(11, 2, "表决意见", wcfFC));


            // 表头结束

            wfont = new jxl.write.WritableFont(WritableFont.ARIAL, 10, WritableFont.NO_BOLD, false, UnderlineStyle.NO_UNDERLINE, Colour.BLACK);
            wcfFC = new WritableCellFormat(wfont);
            wcfFC.setBorder(jxl.format.Border.ALL, jxl.format.BorderLineStyle.THIN);
            wcfFC.setVerticalAlignment(VerticalAlignment.CENTRE);   //设置居中对齐
            wcfFC.setAlignment(Alignment.CENTRE);
            wcfFC.setWrap(true);

            int count = mmList.size();
            int mmpinzhongKaishihang = 3;
            int mmpinpaiKaishihang = 3;


            for (int i = 0; i < count; i++) {
                Map<String, Object> mmPinzhongMap = mmList.get(i);

                String mmPinzhongOne = mmPinzhongMap.get("xuhao") == null ? "" : mmPinzhongMap.get("xuhao").toString();
                int mmHebingshu = 0;

                List<Map<String, Object>> mmPinguilist = fujianyuanyanMapper.findShengchanqiyeByPinguiResult(ppxiangmuid, mmPinzhongOne, ppuserid);
                if (mmPinguilist.size() > 0) {
                    mmHebingshu = mmPinguilist.size() - 1;
                }
                for (int j = 0; j < mmPinguilist.size(); j++) {
                    Map<String, Object> mmPinguiMap = mmPinguilist.get(j);
                    if (mmPinguiMap != null) {
                        String chanpinbianma = mmPinguiMap.get("chanpinbianma") == null ? "" : mmPinguiMap.get("chanpinbianma").toString();
                        String yaopinmingcheng = mmPinguiMap.get("yaopinmingcheng") == null ? "" : mmPinguiMap.get("yaopinmingcheng").toString();
                        String guige = mmPinguiMap.get("guige") == null ? "" : mmPinguiMap.get("guige").toString();
                        String danwei = mmPinguiMap.get("danwei") == null ? "" : mmPinguiMap.get("danwei").toString();
                        String jixing = mmPinguiMap.get("jixing") == null ? "" : mmPinguiMap.get("jixing").toString();
                        String yuanyan = mmPinguiMap.get("yuanyan") == null ? "" : mmPinguiMap.get("yuanyan").toString();
                        String shengchanqiye = mmPinguiMap.get("shengchanqiye") == null ? "" : mmPinguiMap.get("shengchanqiye").toString();
                        String jiage = mmPinguiMap.get("jiage") == null ? "" : mmPinguiMap.get("jiage").toString();
                        String yibao = mmPinguiMap.get("yibao") == null ? "" : mmPinguiMap.get("yibao").toString();
                        String beizhu = mmPinguiMap.get("beizhu") == null ? "" : mmPinguiMap.get("beizhu").toString();

                        String mmresult = mmPinguiMap.get("result") == null ? "" : mmPinguiMap.get("result").toString();
                        String mmbiaojueren = mmPinguiMap.get("username") == null ? "" : mmPinguiMap.get("username").toString();
                        String mmyijian = "";
                        if ("1".equals(mmresult)) {
                            mmyijian = "同意";
                        } else if ("0".equals(mmresult)) {
                            mmyijian = "不同意";
                        } else {
                            mmyijian = "不同意";
                        }
                        wsheet.addCell(new Label(1, mmpinpaiKaishihang, chanpinbianma, wcfFC));
                        wsheet.addCell(new Label(2, mmpinpaiKaishihang, yaopinmingcheng, wcfFC));
                        wsheet.addCell(new Label(3, mmpinpaiKaishihang, guige, wcfFC));
                        wsheet.addCell(new Label(4, mmpinpaiKaishihang, danwei, wcfFC));
                        wsheet.addCell(new Label(5, mmpinpaiKaishihang, jixing, wcfFC));
                        wsheet.addCell(new Label(6, mmpinpaiKaishihang, yuanyan, wcfFC));
                        wsheet.addCell(new Label(7, mmpinpaiKaishihang, shengchanqiye, wcfFC));
                        wsheet.addCell(new Label(8, mmpinpaiKaishihang, jiage, wcfFC));
                        wsheet.addCell(new Label(9, mmpinpaiKaishihang, yibao, wcfFC));
                        wsheet.addCell(new Label(10, mmpinpaiKaishihang, beizhu, wcfFC));
                        wsheet.addCell(new Label(11, mmpinpaiKaishihang, mmyijian, wcfFC));
                        mmpinpaiKaishihang = mmpinpaiKaishihang + 1;
                    }
                }
                wsheet.addCell(new Label(0, mmpinzhongKaishihang, mmPinzhongOne, wcfFC));
                wsheet.mergeCells(0, mmpinzhongKaishihang, 0, mmpinzhongKaishihang + mmHebingshu);
                mmpinzhongKaishihang = mmpinzhongKaishihang + mmHebingshu + 1;

            }
            wbook.write(); // 写入文件
            wbook.close();
        } catch (Exception ex) {
            ex.printStackTrace();
        } finally {
            if (os != null) {
                try {
                    os.close();
                } catch (IOException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }
            }
        }
    }

    public void daochuqianzibiao16(@RequestParam("xiangmuid") String ppxiangmuid,
                                   @RequestParam("userid") String ppuserid,
                                   HttpServletRequest request, HttpServletResponse response) {

        response.reset();
        response.setContentType("application/x-download;charset=utf-8");
        List<Map<String, Object>> mmList = fujianshiliuMapper.selectPingui(ppxiangmuid, 0, Integer.MAX_VALUE);
        String xiangmumingcheng = ysxiangmuService.findOne(ppxiangmuid).getXiangmuname();
        Ysuser mmuser = ddYsuserService.findOne(ppuserid);
        String mmusername = mmuser.getUsername();
        OutputStream os = null;
        WritableWorkbook wbook = null;
        try {
            os = new BufferedOutputStream(response.getOutputStream());//得到输出流的语句
            //response.getOutputStream();// 取得输出流
            response.reset();// 清空输出流
            SimpleDateFormat mmDateFormat = new SimpleDateFormat("yyyyMMdd-HHmmss");
            String wenjiantitle = xiangmumingcheng + mmusername + "委员结果表" + StringHandle.tiemString(); //文件名
            String tmptitle = xiangmumingcheng+"（" + mmusername + "）"; // 标题
            response.setHeader("Content-disposition", "attachment; filename=" + new String(wenjiantitle.getBytes(), "iso8859-1") + ".xls");// 设定输出文件头
            response.setContentType("application/vnd.ms-excel");// 定义输出类型
            wbook = Workbook.createWorkbook(os); // 建立excel文件
            WritableSheet wsheet = wbook.createSheet(tmptitle, 0); // sheet名称
            SheetSettings settings = wsheet.getSettings();
            settings.setProtected(true);
            /*  settings.setPassword("0000");*/
            // 设置excel标题
            WritableFont wfont = new WritableFont(WritableFont.ARIAL, 16, WritableFont.BOLD, false, UnderlineStyle.NO_UNDERLINE, Colour.BLACK); //设置表格样式

            WritableCellFormat wcfFC = new WritableCellFormat(wfont);
            wcfFC.setBorder(jxl.format.Border.ALL, jxl.format.BorderLineStyle.THIN); // 添加边框
            wcfFC.setVerticalAlignment(VerticalAlignment.CENTRE);   //设置居中对齐
            wcfFC.setAlignment(Alignment.CENTRE);

            WritableCellFormat wcfFC3 = new WritableCellFormat(wfont);
            wcfFC3.setVerticalAlignment(VerticalAlignment.CENTRE);   //设置居中对齐
            wcfFC3.setAlignment(Alignment.CENTRE);
            //wcfFC.setBackground(Colour.AQUA);
            Label label = new Label(0, 0, tmptitle, wcfFC3);

            WritableCellFormat cellFormat = new WritableCellFormat();
            cellFormat.setAlignment(jxl.format.Alignment.CENTRE);
            cellFormat.setVerticalAlignment(jxl.format.VerticalAlignment.CENTRE);
            cellFormat.setWrap(true);
            //cellFormat.setBackground(Colour.AQUA);
            cellFormat.setFont(wfont);
            label.setCellFormat(cellFormat);
            wsheet.addCell(label);
            wsheet.addCell(new Label(0, 0, tmptitle, wcfFC3));
            /*wsheet.addCell(new Label(7, 0, tmptitle, wcfFC));*/
            wsheet.setRowView(0, 600); //第一行高度
            wsheet.setRowView(1, 600); //第二行高度
            wsheet.mergeCells(0, 0, 13, 0);  //合并单元格(第一列的第一行和第十三列的第一行合并)
            wsheet.setColumnView(0, 9); //宽度
            wsheet.setColumnView(1, 13); //宽度
            wsheet.setColumnView(2, 13); //药品名称宽度
            wsheet.setColumnView(3, 13); //分类宽度
            wsheet.setColumnView(4, 9); //规格宽度
            wsheet.setColumnView(5, 9); //单位宽度
            wsheet.setColumnView(6, 9); //医保宽度
            wsheet.setColumnView(7, 9); //宽度
            wsheet.setColumnView(8, 9); //宽度
            wsheet.setColumnView(9, 9); //宽度
            wsheet.setColumnView(10, 9); //宽度
            wsheet.setColumnView(11, 13); //宽度
            wsheet.setColumnView(12, 9); //宽度
            wsheet.setColumnView(13, 12); //宽度


            // 开始生成主体内容
            wfont = new jxl.write.WritableFont(WritableFont.ARIAL, 10, WritableFont.BOLD, false, UnderlineStyle.NO_UNDERLINE, Colour.BLACK);
            wcfFC = new WritableCellFormat(wfont);
            wcfFC.setBorder(jxl.format.Border.ALL, jxl.format.BorderLineStyle.THIN);
            wcfFC.setVerticalAlignment(VerticalAlignment.CENTRE);   //设置居中对齐
            wcfFC.setAlignment(Alignment.CENTRE);
            wcfFC.setWrap(true);
            // 不需要边框和居中的样式
            WritableFont wfont2 = new WritableFont(WritableFont.ARIAL, 12, WritableFont.BOLD, false, UnderlineStyle.NO_UNDERLINE, Colour.BLACK); //设置表格样式
            WritableCellFormat wcfFC2 = new WritableCellFormat(wfont2);
            wcfFC2.setVerticalAlignment(jxl.format.VerticalAlignment.CENTRE);// 垂直居中
            wcfFC2 = new WritableCellFormat(wfont2);
            wcfFC2.setWrap(true);
            //  在  1 列  2 行 写入内容
            wsheet.addCell(new Label(0, 1, "投票人(签字):投票内容已核对无误。" + mmusername, wcfFC2));
            // 把  0 列 2 行 到 9 列 2 行合并
            wsheet.mergeCells(0, 1, 7, 1);


            wsheet.addCell(new Label(8, 1, "投票日期:" + StringHandle.shorttiemString(), wcfFC2));
            wsheet.mergeCells(8, 1, 13, 1);

            // 第三行 内容
            wsheet.addCell(new Label(0, 2, "序号", wcfFC));
            wsheet.addCell(new Label(1, 2, "产品编码", wcfFC));
            wsheet.addCell(new Label(2, 2, "药品名称", wcfFC));
            wsheet.addCell(new Label(3, 2, "规格", wcfFC));
            wsheet.addCell(new Label(4, 2, "单位", wcfFC));
            wsheet.addCell(new Label(5, 2, "剂型", wcfFC));
            wsheet.addCell(new Label(6, 2, "生产企业", wcfFC));
            wsheet.addCell(new Label(7, 2, "现价格（元）", wcfFC));
            wsheet.addCell(new Label(8, 2, "基药", wcfFC));
            wsheet.addCell(new Label(9, 2, "医保", wcfFC));
            wsheet.addCell(new Label(10, 2, "是否治疗用药", wcfFC));
            wsheet.addCell(new Label(11, 2, "预选会意见", wcfFC));
            wsheet.addCell(new Label(12, 2, "备注", wcfFC));
            wsheet.addCell(new Label(13, 2, "表决意见", wcfFC));


            // 表头结束

            wfont = new jxl.write.WritableFont(WritableFont.ARIAL, 10, WritableFont.NO_BOLD, false, UnderlineStyle.NO_UNDERLINE, Colour.BLACK);
            wcfFC = new WritableCellFormat(wfont);
            wcfFC.setBorder(jxl.format.Border.ALL, jxl.format.BorderLineStyle.THIN);
            wcfFC.setVerticalAlignment(VerticalAlignment.CENTRE);   //设置居中对齐
            wcfFC.setAlignment(Alignment.CENTRE);
            wcfFC.setWrap(true);

            int count = mmList.size();
            int mmpinzhongKaishihang = 3;
            int mmpinpaiKaishihang = 3;


            for (int i = 0; i < count; i++) {
                Map<String, Object> mmPinzhongMap = mmList.get(i);

                String mmPinzhongOne = mmPinzhongMap.get("xuhao") == null ? "" : mmPinzhongMap.get("xuhao").toString();
                int mmHebingshu = 0;

                List<Map<String, Object>> mmPinguilist = fujianshiliuMapper.findShengchanqiyeByPinguiResult(ppxiangmuid, mmPinzhongOne, ppuserid);
                if (mmPinguilist.size() > 0) {
                    mmHebingshu = mmPinguilist.size() - 1;
                }
                for (int j = 0; j < mmPinguilist.size(); j++) {
                    Map<String, Object> mmPinguiMap = mmPinguilist.get(j);
                    if (mmPinguiMap != null) {
                        String chanpinbianma = mmPinguiMap.get("chanpinbianma") == null ? "" : mmPinguiMap.get("chanpinbianma").toString();
                        String yaopinmingcheng = mmPinguiMap.get("yaopinmingcheng") == null ? "" : mmPinguiMap.get("yaopinmingcheng").toString();
                        String guige = mmPinguiMap.get("guige") == null ? "" : mmPinguiMap.get("guige").toString();
                        String danwei = mmPinguiMap.get("danwei") == null ? "" : mmPinguiMap.get("danwei").toString();
                        String jixing = mmPinguiMap.get("jixing") == null ? "" : mmPinguiMap.get("jixing").toString();
                        String shengchanqiye = mmPinguiMap.get("shengchanqiye") == null ? "" : mmPinguiMap.get("shengchanqiye").toString();
                        String jiage = mmPinguiMap.get("jiage") == null ? "" : mmPinguiMap.get("jiage").toString();
                        String jiyao = mmPinguiMap.get("jiyao") == null ? "" : mmPinguiMap.get("jiyao").toString();
                        String yibao = mmPinguiMap.get("yibao") == null ? "" : mmPinguiMap.get("yibao").toString();
                        String shifouzhiliaoyongyao = mmPinguiMap.get("shifouzhiliaoyongyao") == null ? "" : mmPinguiMap.get("shifouzhiliaoyongyao").toString();
                        String yuxuanhuiyijian = mmPinguiMap.get("yuxuanhuiyijian") == null ? "" : mmPinguiMap.get("yuxuanhuiyijian").toString();
                        String beizhu = mmPinguiMap.get("beizhu") == null ? "" : mmPinguiMap.get("beizhu").toString();

                        String mmresult = mmPinguiMap.get("result") == null ? "" : mmPinguiMap.get("result").toString();
                        String mmbiaojueren = mmPinguiMap.get("username") == null ? "" : mmPinguiMap.get("username").toString();
                        String mmyijian = "";
                        if ("1".equals(mmresult)) {
                            mmyijian = "同意";
                        } else if ("0".equals(mmresult)) {
                            mmyijian = "不同意";
                        } else {
                            mmyijian = "不同意";
                        }
                        wsheet.setRowView(mmpinpaiKaishihang,700);
                        wsheet.addCell(new Label(1, mmpinpaiKaishihang, chanpinbianma, wcfFC));
                        wsheet.addCell(new Label(2, mmpinpaiKaishihang, yaopinmingcheng, wcfFC));
                        wsheet.addCell(new Label(3, mmpinpaiKaishihang, guige, wcfFC));
                        wsheet.addCell(new Label(4, mmpinpaiKaishihang, danwei, wcfFC));
                        wsheet.addCell(new Label(5, mmpinpaiKaishihang, jixing, wcfFC));
                        wsheet.addCell(new Label(6, mmpinpaiKaishihang, shengchanqiye, wcfFC));
                        wsheet.addCell(new Label(7, mmpinpaiKaishihang, jiage, wcfFC));
                        wsheet.addCell(new Label(8, mmpinpaiKaishihang, jiyao, wcfFC));
                        wsheet.addCell(new Label(9, mmpinpaiKaishihang, yibao, wcfFC));
                        wsheet.addCell(new Label(10, mmpinpaiKaishihang, shifouzhiliaoyongyao, wcfFC));
                        wsheet.addCell(new Label(11, mmpinpaiKaishihang, yuxuanhuiyijian, wcfFC));
                        wsheet.addCell(new Label(12, mmpinpaiKaishihang, beizhu, wcfFC));
                        wsheet.addCell(new Label(13, mmpinpaiKaishihang, mmyijian, wcfFC));
                        mmpinpaiKaishihang = mmpinpaiKaishihang + 1;
                    }
                }
                wsheet.addCell(new Label(0, mmpinzhongKaishihang, mmPinzhongOne, wcfFC));
                wsheet.mergeCells(0, mmpinzhongKaishihang, 0, mmpinzhongKaishihang + mmHebingshu);
                mmpinzhongKaishihang = mmpinzhongKaishihang + mmHebingshu + 1;

            }
            wbook.write(); // 写入文件
            wbook.close();
        } catch (Exception ex) {
            ex.printStackTrace();
        } finally {
            if (os != null) {
                try {
                    os.close();
                } catch (IOException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }
            }
        }
    }

    public void daochuqianzibiaokjjb(@RequestParam("xiangmuid") String ppxiangmuid,
                                     @RequestParam("userid") String ppuserid,
                                     HttpServletRequest request, HttpServletResponse response) {

        response.reset();
        response.setContentType("application/x-download;charset=utf-8");
        List<Map<String, Object>> mmList = fujiankjjibenMapper.selectPingui(ppxiangmuid, 0, Integer.MAX_VALUE);
        String xiangmumingcheng = ysxiangmuService.findOne(ppxiangmuid).getXiangmuname();
        Ysuser mmuser = ddYsuserService.findOne(ppuserid);
        String mmusername = mmuser.getUsername();
        OutputStream os = null;
        WritableWorkbook wbook = null;
        try {
            os = new BufferedOutputStream(response.getOutputStream());//得到输出流的语句
            //response.getOutputStream();// 取得输出流
            response.reset();// 清空输出流
            SimpleDateFormat mmDateFormat = new SimpleDateFormat("yyyyMMdd-HHmmss");
            String wenjiantitle = xiangmumingcheng + mmusername + "委员结果表" + StringHandle.tiemString(); //文件名
            String tmptitle = xiangmumingcheng+"（" + mmusername + "）"; // 标题
            response.setHeader("Content-disposition", "attachment; filename=" + new String(wenjiantitle.getBytes(), "iso8859-1") + ".xls");// 设定输出文件头
            response.setContentType("application/vnd.ms-excel");// 定义输出类型
            wbook = Workbook.createWorkbook(os); // 建立excel文件
            WritableSheet wsheet = wbook.createSheet(tmptitle, 0); // sheet名称
            SheetSettings settings = wsheet.getSettings();
            settings.setProtected(true);
            /*  settings.setPassword("0000");*/
            // 设置excel标题
            WritableFont wfont = new WritableFont(WritableFont.ARIAL, 16, WritableFont.BOLD, false, UnderlineStyle.NO_UNDERLINE, Colour.BLACK); //设置表格样式

            WritableCellFormat wcfFC = new WritableCellFormat(wfont);
            wcfFC.setBorder(jxl.format.Border.ALL, jxl.format.BorderLineStyle.THIN); // 添加边框
            wcfFC.setVerticalAlignment(VerticalAlignment.CENTRE);   //设置居中对齐
            wcfFC.setAlignment(Alignment.CENTRE);

            WritableCellFormat wcfFC3 = new WritableCellFormat(wfont);
            wcfFC3.setVerticalAlignment(VerticalAlignment.CENTRE);   //设置居中对齐
            wcfFC3.setAlignment(Alignment.CENTRE);
            //wcfFC.setBackground(Colour.AQUA);
            Label label = new Label(0, 0, tmptitle, wcfFC3);

            WritableCellFormat cellFormat = new WritableCellFormat();
            cellFormat.setAlignment(jxl.format.Alignment.CENTRE);
            cellFormat.setVerticalAlignment(jxl.format.VerticalAlignment.CENTRE);
            cellFormat.setWrap(true);
            //cellFormat.setBackground(Colour.AQUA);
            cellFormat.setFont(wfont);
            label.setCellFormat(cellFormat);
            wsheet.addCell(label);
            wsheet.addCell(new Label(0, 0, tmptitle, wcfFC3));
            /*wsheet.addCell(new Label(7, 0, tmptitle, wcfFC));*/
            wsheet.setRowView(0, 600); //第一行高度
            wsheet.setRowView(1, 600); //第二行高度
            wsheet.mergeCells(0, 0, 19, 0);  //合并单元格(第一列的第一行和第十三列的第一行合并)
            wsheet.setColumnView(0, 6); //宽度
            wsheet.setColumnView(1, 11); //宽度
            wsheet.setColumnView(2, 10); //药品名称宽度
            wsheet.setColumnView(3, 10); //分类宽度
            wsheet.setColumnView(4, 8); //规格宽度
            wsheet.setColumnView(5, 7); //单位宽度
            wsheet.setColumnView(6, 7); //医保宽度
            wsheet.setColumnView(7, 5); //宽度
            wsheet.setColumnView(8, 5); //宽度
            wsheet.setColumnView(9, 11); //宽度
            wsheet.setColumnView(10, 7); //宽度
            wsheet.setColumnView(11, 7); //宽度
            wsheet.setColumnView(12, 7); //宽度
            wsheet.setColumnView(13, 9); //宽度
            wsheet.setColumnView(14, 8); //宽度
            wsheet.setColumnView(15, 8); //宽度
            wsheet.setColumnView(16, 10); //宽度
            wsheet.setColumnView(17, 7); //宽度
            wsheet.setColumnView(18, 10); //宽度
            wsheet.setColumnView(19, 13); //宽度


            // 开始生成主体内容
            wfont = new jxl.write.WritableFont(WritableFont.ARIAL, 10, WritableFont.BOLD, false, UnderlineStyle.NO_UNDERLINE, Colour.BLACK);
            wcfFC = new WritableCellFormat(wfont);
            wcfFC.setBorder(jxl.format.Border.ALL, jxl.format.BorderLineStyle.THIN);
            wcfFC.setVerticalAlignment(VerticalAlignment.CENTRE);   //设置居中对齐
            wcfFC.setAlignment(Alignment.CENTRE);
            wcfFC.setWrap(true);
            // 不需要边框和居中的样式
            WritableFont wfont2 = new WritableFont(WritableFont.ARIAL, 12, WritableFont.BOLD, false, UnderlineStyle.NO_UNDERLINE, Colour.BLACK); //设置表格样式
            WritableCellFormat wcfFC2 = new WritableCellFormat(wfont2);
            wcfFC2.setVerticalAlignment(jxl.format.VerticalAlignment.CENTRE);// 垂直居中
            wcfFC2 = new WritableCellFormat(wfont2);
            wcfFC2.setWrap(true);
            //  在  1 列  2 行 写入内容
            wsheet.addCell(new Label(0, 1, "投票人(签字):投票内容已核对无误。" + mmusername, wcfFC2));
            // 把  0 列 2 行 到 9 列 2 行合并
            wsheet.mergeCells(0, 1, 13, 1);


            wsheet.addCell(new Label(14, 1, "投票日期:" + StringHandle.shorttiemString(), wcfFC2));
            wsheet.mergeCells(14, 1, 19, 1);

            // 第三行 内容
            wsheet.addCell(new Label(0, 2, "序号", wcfFC));
            wsheet.addCell(new Label(1, 2, "产品编码", wcfFC));
            wsheet.addCell(new Label(2, 2, "药品名称", wcfFC));
            wsheet.addCell(new Label(3, 2, "分类", wcfFC));
            wsheet.addCell(new Label(4, 2, "品种/品规限制", wcfFC));
            wsheet.addCell(new Label(5, 2, "规格", wcfFC));
            wsheet.addCell(new Label(6, 2, "价格（元）", wcfFC));
            wsheet.addCell(new Label(7, 2, "单位", wcfFC));
            wsheet.addCell(new Label(8, 2, "剂型", wcfFC));
            wsheet.addCell(new Label(9, 2, "生产企业", wcfFC));
            wsheet.addCell(new Label(10, 2, "医保类别", wcfFC));
            wsheet.addCell(new Label(11, 2, "基药", wcfFC));
            wsheet.addCell(new Label(12, 2, "一致性评价", wcfFC));
            wsheet.addCell(new Label(13, 2, "15版指导原则", wcfFC));
            wsheet.addCell(new Label(14, 2, "申请总次数", wcfFC));
            wsheet.addCell(new Label(15, 2, "申请总数量", wcfFC));
            wsheet.addCell(new Label(16, 2, "申请科室", wcfFC));
            wsheet.addCell(new Label(17, 2, "预选会意见", wcfFC));
            wsheet.addCell(new Label(18, 2, "备注", wcfFC));
            wsheet.addCell(new Label(19, 2, "表决意见", wcfFC));


            // 表头结束

            wfont = new jxl.write.WritableFont(WritableFont.ARIAL, 10, WritableFont.NO_BOLD, false, UnderlineStyle.NO_UNDERLINE, Colour.BLACK);
            wcfFC = new WritableCellFormat(wfont);
            wcfFC.setBorder(jxl.format.Border.ALL, jxl.format.BorderLineStyle.THIN);
            wcfFC.setVerticalAlignment(VerticalAlignment.CENTRE);   //设置居中对齐
            wcfFC.setAlignment(Alignment.CENTRE);
            wcfFC.setWrap(true);

            int count = mmList.size();
            int mmpinzhongKaishihang = 3;
            int mmpinpaiKaishihang = 3;


            for (int i = 0; i < count; i++) {
                Map<String, Object> mmPinzhongMap = mmList.get(i);

                String mmPinzhongOne = mmPinzhongMap.get("xuhao") == null ? "" : mmPinzhongMap.get("xuhao").toString();
                int mmHebingshu = 0;

                List<Map<String, Object>> mmPinguilist = fujiankjjibenMapper.findShengchanqiyeByPinguiResult(ppxiangmuid, mmPinzhongOne, ppuserid);
                if (mmPinguilist.size() > 0) {
                    mmHebingshu = mmPinguilist.size() - 1;
                }
                for (int j = 0; j < mmPinguilist.size(); j++) {
                    Map<String, Object> mmPinguiMap = mmPinguilist.get(j);
                    if (mmPinguiMap != null) {
                        String yaopinmingcheng = mmPinguiMap.get("yaopinmingcheng") == null ? "" : mmPinguiMap.get("yaopinmingcheng").toString();
                        String chanpinbianma = mmPinguiMap.get("beuzhu1") == null ? "" : mmPinguiMap.get("beuzhu1").toString();
                        String fenlei = mmPinguiMap.get("fenlei") == null ? "" : mmPinguiMap.get("fenlei").toString();
                        String xianzhi = mmPinguiMap.get("beizhu2") == null ? "" : mmPinguiMap.get("beizhu2").toString();
                        String guige = mmPinguiMap.get("guige") == null ? "" : mmPinguiMap.get("guige").toString();
                        String jiage = mmPinguiMap.get("jiage") == null ? "" : mmPinguiMap.get("jiage").toString();
                        String danwei = mmPinguiMap.get("danwei") == null ? "" : mmPinguiMap.get("danwei").toString();
                        String jixing = mmPinguiMap.get("beizhu3") == null ? "" : mmPinguiMap.get("beizhu3").toString();
                        String shengchanqiye = mmPinguiMap.get("beizhu4") == null ? "" : mmPinguiMap.get("beizhu4").toString();
                        String yibaoleibie = mmPinguiMap.get("yibaoleibie") == null ? "" : mmPinguiMap.get("yibaoleibie").toString();
                        String jiyao = mmPinguiMap.get("jiyao") == null ? "" : mmPinguiMap.get("jiyao").toString();
                        String yizhixingpingjia = mmPinguiMap.get("yizhixingpingjia") == null ? "" : mmPinguiMap.get("yizhixingpingjia").toString();
                        String zhidaoyuanze = mmPinguiMap.get("zhidaoyuanze") == null ? "" : mmPinguiMap.get("zhidaoyuanze").toString();
                        String lincaizongcishu = mmPinguiMap.get("lincaizongcishu") == null ? "" : mmPinguiMap.get("lincaizongcishu").toString();
                        String lincaizongshulinag = mmPinguiMap.get("lincaizongshulinag") == null ? "" : mmPinguiMap.get("lincaizongshulinag").toString();
                        String shenqingkeshi = mmPinguiMap.get("shenqingkeshi") == null ? "" : mmPinguiMap.get("shenqingkeshi").toString();
                        String yuxuanhuiyijian = mmPinguiMap.get("yuxuanhuiyijian") == null ? "" : mmPinguiMap.get("yuxuanhuiyijian").toString();
                        String beizhu = mmPinguiMap.get("beizhu") == null ? "" : mmPinguiMap.get("beizhu").toString();

                        String mmresult = mmPinguiMap.get("result") == null ? "" : mmPinguiMap.get("result").toString();
                        String mmbiaojueren = mmPinguiMap.get("username") == null ? "" : mmPinguiMap.get("username").toString();
                        String mmyijian = "";
                        if ("1".equals(mmresult)) {
                            mmyijian = "同意";
                        } else if ("0".equals(mmresult)) {
                            mmyijian = "不同意";
                        } else {
                            mmyijian = "不同意";
                        }
                        wsheet.setRowView(mmpinpaiKaishihang,700);
                        wsheet.addCell(new Label(1, mmpinpaiKaishihang, chanpinbianma, wcfFC));
                        wsheet.addCell(new Label(2, mmpinpaiKaishihang, yaopinmingcheng, wcfFC));
                        wsheet.addCell(new Label(3, mmpinpaiKaishihang, fenlei, wcfFC));
                        wsheet.addCell(new Label(4, mmpinpaiKaishihang, xianzhi, wcfFC));
                        wsheet.addCell(new Label(5, mmpinpaiKaishihang, guige, wcfFC));
                        wsheet.addCell(new Label(6, mmpinpaiKaishihang, jiage, wcfFC));
                        wsheet.addCell(new Label(7, mmpinpaiKaishihang, danwei, wcfFC));
                        wsheet.addCell(new Label(8, mmpinpaiKaishihang, jixing, wcfFC));
                        wsheet.addCell(new Label(9, mmpinpaiKaishihang, shengchanqiye, wcfFC));
                        wsheet.addCell(new Label(10, mmpinpaiKaishihang, yibaoleibie, wcfFC));
                        wsheet.addCell(new Label(11, mmpinpaiKaishihang, jiyao, wcfFC));
                        wsheet.addCell(new Label(12, mmpinpaiKaishihang, yizhixingpingjia, wcfFC));
                        wsheet.addCell(new Label(13, mmpinpaiKaishihang, zhidaoyuanze, wcfFC));
                        wsheet.addCell(new Label(14, mmpinpaiKaishihang, lincaizongcishu, wcfFC));
                        wsheet.addCell(new Label(15, mmpinpaiKaishihang, lincaizongshulinag, wcfFC));
                        wsheet.addCell(new Label(16, mmpinpaiKaishihang, shenqingkeshi, wcfFC));
                        wsheet.addCell(new Label(17, mmpinpaiKaishihang, yuxuanhuiyijian, wcfFC));
                        wsheet.addCell(new Label(18, mmpinpaiKaishihang, beizhu, wcfFC));
                        wsheet.addCell(new Label(19, mmpinpaiKaishihang, mmyijian, wcfFC));
                        mmpinpaiKaishihang = mmpinpaiKaishihang + 1;
                    }
                }
                wsheet.addCell(new Label(0, mmpinzhongKaishihang, mmPinzhongOne, wcfFC));
                wsheet.mergeCells(0, mmpinzhongKaishihang, 0, mmpinzhongKaishihang + mmHebingshu);
                mmpinzhongKaishihang = mmpinzhongKaishihang + mmHebingshu + 1;

            }
            wbook.write(); // 写入文件
            wbook.close();
        } catch (Exception ex) {
            ex.printStackTrace();
        } finally {
            if (os != null) {
                try {
                    os.close();
                } catch (IOException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }
            }
        }
    }

    public void daochuqianzibiaokjyc(@RequestParam("xiangmuid") String ppxiangmuid,
                                     @RequestParam("userid") String ppuserid,
                                     HttpServletRequest request, HttpServletResponse response) {

        response.reset();
        response.setContentType("application/x-download;charset=utf-8");
        List<Map<String, Object>> mmList = fujiankjyuecaiMapper.selectPingui(ppxiangmuid, 0, Integer.MAX_VALUE);
        String xiangmumingcheng = ysxiangmuService.findOne(ppxiangmuid).getXiangmuname();
        Ysuser mmuser = ddYsuserService.findOne(ppuserid);
        String mmusername = mmuser.getUsername();
        OutputStream os = null;
        WritableWorkbook wbook = null;
        try {
            os = new BufferedOutputStream(response.getOutputStream());//得到输出流的语句
            //response.getOutputStream();// 取得输出流
            response.reset();// 清空输出流
            SimpleDateFormat mmDateFormat = new SimpleDateFormat("yyyyMMdd-HHmmss");
            String wenjiantitle = xiangmumingcheng + mmusername + "委员结果表" + StringHandle.tiemString(); //文件名
            String tmptitle = xiangmumingcheng+"（" + mmusername + "）"; // 标题
            response.setHeader("Content-disposition", "attachment; filename=" + new String(wenjiantitle.getBytes(), "iso8859-1") + ".xls");// 设定输出文件头
            response.setContentType("application/vnd.ms-excel");// 定义输出类型
            wbook = Workbook.createWorkbook(os); // 建立excel文件
            WritableSheet wsheet = wbook.createSheet(tmptitle, 0); // sheet名称
            SheetSettings settings = wsheet.getSettings();
            settings.setProtected(true);
            /*  settings.setPassword("0000");*/
            // 设置excel标题
            WritableFont wfont = new WritableFont(WritableFont.ARIAL, 16, WritableFont.BOLD, false, UnderlineStyle.NO_UNDERLINE, Colour.BLACK); //设置表格样式

            WritableCellFormat wcfFC = new WritableCellFormat(wfont);
            wcfFC.setBorder(jxl.format.Border.ALL, jxl.format.BorderLineStyle.THIN); // 添加边框
            wcfFC.setVerticalAlignment(VerticalAlignment.CENTRE);   //设置居中对齐
            wcfFC.setAlignment(Alignment.CENTRE);

            WritableCellFormat wcfFC3 = new WritableCellFormat(wfont);
            wcfFC3.setVerticalAlignment(VerticalAlignment.CENTRE);   //设置居中对齐
            wcfFC3.setAlignment(Alignment.CENTRE);
            //wcfFC.setBackground(Colour.AQUA);
            Label label = new Label(0, 0, tmptitle, wcfFC3);

            WritableCellFormat cellFormat = new WritableCellFormat();
            cellFormat.setAlignment(jxl.format.Alignment.CENTRE);
            cellFormat.setVerticalAlignment(jxl.format.VerticalAlignment.CENTRE);
            cellFormat.setWrap(true);
            //cellFormat.setBackground(Colour.AQUA);
            cellFormat.setFont(wfont);
            label.setCellFormat(cellFormat);
            wsheet.addCell(label);
            wsheet.addCell(new Label(0, 0, tmptitle, wcfFC3));
            /*wsheet.addCell(new Label(7, 0, tmptitle, wcfFC));*/
            wsheet.setRowView(0, 600); //第一行高度
            wsheet.setRowView(1, 600); //第二行高度
            wsheet.mergeCells(0, 0, 12, 0);  //合并单元格(第一列的第一行和第十三列的第一行合并)
            wsheet.setColumnView(0, 7); //宽度
            wsheet.setColumnView(1, 15); //宽度
            wsheet.setColumnView(2, 19); //药品名称宽度
            wsheet.setColumnView(3, 14); //分类宽度
            wsheet.setColumnView(4, 21); //规格宽度
            wsheet.setColumnView(5, 9); //单位宽度
            wsheet.setColumnView(6, 12); //医保宽度
            wsheet.setColumnView(7, 17); //宽度
            wsheet.setColumnView(8, 17); //宽度
            wsheet.setColumnView(9, 11); //宽度
            wsheet.setColumnView(10, 11); //宽度
            wsheet.setColumnView(11, 12); //宽度
            wsheet.setColumnView(12, 12); //宽度



            // 开始生成主体内容
            wfont = new jxl.write.WritableFont(WritableFont.ARIAL, 10, WritableFont.BOLD, false, UnderlineStyle.NO_UNDERLINE, Colour.BLACK);
            wcfFC = new WritableCellFormat(wfont);
            wcfFC.setBorder(jxl.format.Border.ALL, jxl.format.BorderLineStyle.THIN);
            wcfFC.setVerticalAlignment(VerticalAlignment.CENTRE);   //设置居中对齐
            wcfFC.setAlignment(Alignment.CENTRE);
            wcfFC.setWrap(true);
            // 不需要边框和居中的样式
            WritableFont wfont2 = new WritableFont(WritableFont.ARIAL, 12, WritableFont.BOLD, false, UnderlineStyle.NO_UNDERLINE, Colour.BLACK); //设置表格样式
            WritableCellFormat wcfFC2 = new WritableCellFormat(wfont2);
            wcfFC2.setVerticalAlignment(jxl.format.VerticalAlignment.CENTRE);// 垂直居中
            wcfFC2 = new WritableCellFormat(wfont2);
            wcfFC2.setWrap(true);
            //  在  1 列  2 行 写入内容
            wsheet.addCell(new Label(0, 1, "投票人(签字):投票内容已核对无误。" + mmusername, wcfFC2));
            // 把  0 列 2 行 到 9 列 2 行合并
            wsheet.mergeCells(0, 1, 7, 1);


            wsheet.addCell(new Label(8, 1, "投票日期:" + StringHandle.shorttiemString(), wcfFC2));
            wsheet.mergeCells(8, 1, 12, 1);

            // 第三行 内容
            wsheet.addCell(new Label(0, 2, "序号", wcfFC));
            wsheet.addCell(new Label(1, 2, "产品编码", wcfFC));
            wsheet.addCell(new Label(2, 2, "药品名称", wcfFC));
            wsheet.addCell(new Label(3, 2, "分类", wcfFC));
            wsheet.addCell(new Label(4, 2, "规格", wcfFC));
            wsheet.addCell(new Label(5, 2, "价格（元）", wcfFC));
            wsheet.addCell(new Label(6, 2, "剂型", wcfFC));
            wsheet.addCell(new Label(7, 2, "生产企业", wcfFC));
            wsheet.addCell(new Label(8, 2, "医保类别", wcfFC));
            wsheet.addCell(new Label(9, 2, "一致性评价", wcfFC));
            wsheet.addCell(new Label(10, 2, "预选会意见", wcfFC));
            wsheet.addCell(new Label(11, 2, "备注", wcfFC));
            wsheet.addCell(new Label(12, 2, "表决意见", wcfFC));


            // 表头结束

            wfont = new jxl.write.WritableFont(WritableFont.ARIAL, 10, WritableFont.NO_BOLD, false, UnderlineStyle.NO_UNDERLINE, Colour.BLACK);
            wcfFC = new WritableCellFormat(wfont);
            wcfFC.setBorder(jxl.format.Border.ALL, jxl.format.BorderLineStyle.THIN);
            wcfFC.setVerticalAlignment(VerticalAlignment.CENTRE);   //设置居中对齐
            wcfFC.setAlignment(Alignment.CENTRE);
            wcfFC.setWrap(true);

            int count = mmList.size();
            int mmpinzhongKaishihang = 3;
            int mmpinpaiKaishihang = 3;


            for (int i = 0; i < count; i++) {
                Map<String, Object> mmPinzhongMap = mmList.get(i);

                String mmPinzhongOne = mmPinzhongMap.get("xuhao") == null ? "" : mmPinzhongMap.get("xuhao").toString();
                int mmHebingshu = 0;

                List<Map<String, Object>> mmPinguilist = fujiankjyuecaiMapper.findShengchanqiyeByPinguiResult(ppxiangmuid, mmPinzhongOne, ppuserid);
                if (mmPinguilist.size() > 0) {
                    mmHebingshu = mmPinguilist.size() - 1;
                }
                for (int j = 0; j < mmPinguilist.size(); j++) {
                    Map<String, Object> mmPinguiMap = mmPinguilist.get(j);
                    if (mmPinguiMap != null) {
                        String yaopinmingcheng = mmPinguiMap.get("yaopinmingcheng") == null ? "" : mmPinguiMap.get("yaopinmingcheng").toString();
                        String chanpinbianma = mmPinguiMap.get("beuzhu1") == null ? "" : mmPinguiMap.get("beuzhu1").toString();
                        String fenlei = mmPinguiMap.get("fenlei") == null ? "" : mmPinguiMap.get("fenlei").toString();
                        String guige = mmPinguiMap.get("guige") == null ? "" : mmPinguiMap.get("guige").toString();
                        String jiage = mmPinguiMap.get("jiage") == null ? "" : mmPinguiMap.get("jiage").toString();
                        String jixing = mmPinguiMap.get("beizhu2") == null ? "" : mmPinguiMap.get("beizhu2").toString();
                        String shengchanqiye = mmPinguiMap.get("shengchanqiye") == null ? "" : mmPinguiMap.get("shengchanqiye").toString();
                        String yibaoleibie = mmPinguiMap.get("yibaoleibie") == null ? "" : mmPinguiMap.get("yibaoleibie").toString();
                        String yizhixingpingjia = mmPinguiMap.get("beizhu3") == null ? "" : mmPinguiMap.get("beizhu3").toString();
                        String yuxuanhuiyijian = mmPinguiMap.get("yuxuanhuiyijian") == null ? "" : mmPinguiMap.get("yuxuanhuiyijian").toString();
                        String beizhu = mmPinguiMap.get("beizhu") == null ? "" : mmPinguiMap.get("beizhu").toString();

                        String mmresult = mmPinguiMap.get("result") == null ? "" : mmPinguiMap.get("result").toString();
                        String mmbiaojueren = mmPinguiMap.get("username") == null ? "" : mmPinguiMap.get("username").toString();
                        String mmyijian = "";
                        if ("1".equals(mmresult)) {
                            mmyijian = "同意";
                        } else if ("0".equals(mmresult)) {
                            mmyijian = "不同意";
                        } else {
                            mmyijian = "不同意";
                        }
                        wsheet.setRowView(mmpinpaiKaishihang,700);
                        wsheet.addCell(new Label(1, mmpinpaiKaishihang, chanpinbianma, wcfFC));
                        wsheet.addCell(new Label(2, mmpinpaiKaishihang, yaopinmingcheng, wcfFC));
                        wsheet.addCell(new Label(3, mmpinpaiKaishihang, fenlei, wcfFC));
                        wsheet.addCell(new Label(4, mmpinpaiKaishihang, guige, wcfFC));
                        wsheet.addCell(new Label(5, mmpinpaiKaishihang, jiage, wcfFC));
                        wsheet.addCell(new Label(6, mmpinpaiKaishihang, jixing, wcfFC));
                        wsheet.addCell(new Label(7, mmpinpaiKaishihang, shengchanqiye, wcfFC));
                        wsheet.addCell(new Label(8, mmpinpaiKaishihang, yibaoleibie, wcfFC));
                        wsheet.addCell(new Label(9, mmpinpaiKaishihang, yizhixingpingjia, wcfFC));
                        wsheet.addCell(new Label(10, mmpinpaiKaishihang, yuxuanhuiyijian, wcfFC));
                        wsheet.addCell(new Label(11, mmpinpaiKaishihang, beizhu, wcfFC));
                        wsheet.addCell(new Label(12, mmpinpaiKaishihang, mmyijian, wcfFC));
                        mmpinpaiKaishihang = mmpinpaiKaishihang + 1;
                    }
                }
                wsheet.addCell(new Label(0, mmpinzhongKaishihang, mmPinzhongOne, wcfFC));
                wsheet.mergeCells(0, mmpinzhongKaishihang, 0, mmpinzhongKaishihang + mmHebingshu);
                mmpinzhongKaishihang = mmpinzhongKaishihang + mmHebingshu + 1;

            }
            wbook.write(); // 写入文件
            wbook.close();
        } catch (Exception ex) {
            ex.printStackTrace();
        } finally {
            if (os != null) {
                try {
                    os.close();
                } catch (IOException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }
            }
        }
    }


    public void daochuqianzibiaokjwufagongying(@RequestParam("xiangmuid") String ppxiangmuid,
                                     @RequestParam("userid") String ppuserid,
                                     HttpServletRequest request, HttpServletResponse response) {

        response.reset();
        response.setContentType("application/x-download;charset=utf-8");
        List<Map<String, Object>> mmList = fujiankjjibenMapper.selectPingui(ppxiangmuid, 0, Integer.MAX_VALUE);
        String xiangmumingcheng = ysxiangmuService.findOne(ppxiangmuid).getXiangmuname();
        Ysuser mmuser = ddYsuserService.findOne(ppuserid);
        String mmusername = mmuser.getUsername();
        OutputStream os = null;
        WritableWorkbook wbook = null;
        try {
            os = new BufferedOutputStream(response.getOutputStream());//得到输出流的语句
            //response.getOutputStream();// 取得输出流
            response.reset();// 清空输出流
            SimpleDateFormat mmDateFormat = new SimpleDateFormat("yyyyMMdd-HHmmss");
            String wenjiantitle = xiangmumingcheng + mmusername + "委员结果表" + StringHandle.tiemString(); //文件名
            String tmptitle = xiangmumingcheng+"（" + mmusername + "）"; // 标题
            response.setHeader("Content-disposition", "attachment; filename=" + new String(wenjiantitle.getBytes(), "iso8859-1") + ".xls");// 设定输出文件头
            response.setContentType("application/vnd.ms-excel");// 定义输出类型
            wbook = Workbook.createWorkbook(os); // 建立excel文件
            WritableSheet wsheet = wbook.createSheet(tmptitle, 0); // sheet名称
            SheetSettings settings = wsheet.getSettings();
            settings.setProtected(true);
            /*  settings.setPassword("0000");*/
            // 设置excel标题
            WritableFont wfont = new WritableFont(WritableFont.ARIAL, 16, WritableFont.BOLD, false, UnderlineStyle.NO_UNDERLINE, Colour.BLACK); //设置表格样式

            WritableCellFormat wcfFC = new WritableCellFormat(wfont);
            wcfFC.setBorder(jxl.format.Border.ALL, jxl.format.BorderLineStyle.THIN); // 添加边框
            wcfFC.setVerticalAlignment(VerticalAlignment.CENTRE);   //设置居中对齐
            wcfFC.setAlignment(Alignment.CENTRE);

            WritableCellFormat wcfFC3 = new WritableCellFormat(wfont);
            wcfFC3.setVerticalAlignment(VerticalAlignment.CENTRE);   //设置居中对齐
            wcfFC3.setAlignment(Alignment.CENTRE);
            //wcfFC.setBackground(Colour.AQUA);
            Label label = new Label(0, 0, tmptitle, wcfFC3);

            WritableCellFormat cellFormat = new WritableCellFormat();
            cellFormat.setAlignment(jxl.format.Alignment.CENTRE);
            cellFormat.setVerticalAlignment(jxl.format.VerticalAlignment.CENTRE);
            cellFormat.setWrap(true);
            //cellFormat.setBackground(Colour.AQUA);
            cellFormat.setFont(wfont);
            label.setCellFormat(cellFormat);
            wsheet.addCell(label);
            wsheet.addCell(new Label(0, 0, tmptitle, wcfFC3));
            /*wsheet.addCell(new Label(7, 0, tmptitle, wcfFC));*/
            wsheet.setRowView(0, 600); //第一行高度
            wsheet.setRowView(1, 600); //第二行高度
            wsheet.mergeCells(0, 0, 15, 0);  //合并单元格(第一列的第一行和第十三列的第一行合并)
            wsheet.setColumnView(0, 9); //宽度
            wsheet.setColumnView(1, 9); //宽度
            wsheet.setColumnView(2, 9); //药品名称宽度
            wsheet.setColumnView(3, 9); //分类宽度
            wsheet.setColumnView(4, 9); //规格宽度
            wsheet.setColumnView(5, 9); //单位宽度
            wsheet.setColumnView(6, 9); //医保宽度
            wsheet.setColumnView(7, 9); //宽度
            wsheet.setColumnView(8, 9); //宽度
            wsheet.setColumnView(9, 9); //宽度
            wsheet.setColumnView(10, 9); //宽度
            wsheet.setColumnView(11, 9); //宽度
            wsheet.setColumnView(12, 9); //宽度
            wsheet.setColumnView(13, 9); //宽度
            wsheet.setColumnView(14, 9); //宽度
            wsheet.setColumnView(15, 9); //宽度



            // 开始生成主体内容
            wfont = new jxl.write.WritableFont(WritableFont.ARIAL, 10, WritableFont.BOLD, false, UnderlineStyle.NO_UNDERLINE, Colour.BLACK);
            wcfFC = new WritableCellFormat(wfont);
            wcfFC.setBorder(jxl.format.Border.ALL, jxl.format.BorderLineStyle.THIN);
            wcfFC.setVerticalAlignment(VerticalAlignment.CENTRE);   //设置居中对齐
            wcfFC.setAlignment(Alignment.CENTRE);
            wcfFC.setWrap(true);
            // 不需要边框和居中的样式
            WritableFont wfont2 = new WritableFont(WritableFont.ARIAL, 12, WritableFont.BOLD, false, UnderlineStyle.NO_UNDERLINE, Colour.BLACK); //设置表格样式
            WritableCellFormat wcfFC2 = new WritableCellFormat(wfont2);
            wcfFC2.setVerticalAlignment(jxl.format.VerticalAlignment.CENTRE);// 垂直居中
            wcfFC2 = new WritableCellFormat(wfont2);
            wcfFC2.setWrap(true);
            //  在  1 列  2 行 写入内容
            wsheet.addCell(new Label(0, 1, "投票人(签字):投票内容已核对无误。" + mmusername, wcfFC2));
            // 把  0 列 2 行 到 9 列 2 行合并
            wsheet.mergeCells(0, 1, 9, 1);


            wsheet.addCell(new Label(10, 1, "投票日期:" + StringHandle.shorttiemString(), wcfFC2));
            wsheet.mergeCells(10, 1, 15, 1);

            // 第三行 内容
            wsheet.addCell(new Label(0, 2, "序号", wcfFC));
            wsheet.addCell(new Label(1, 2, "产品编码", wcfFC));
            wsheet.addCell(new Label(2, 2, "药品名称", wcfFC));
            wsheet.addCell(new Label(3, 2, "分类", wcfFC));
            wsheet.addCell(new Label(4, 2, "规格", wcfFC));
            wsheet.addCell(new Label(5, 2, "价格（元）", wcfFC));
            wsheet.addCell(new Label(6, 2, "单位", wcfFC));
            wsheet.addCell(new Label(7, 2, "剂型", wcfFC));
            wsheet.addCell(new Label(8, 2, "生产企业", wcfFC));
            wsheet.addCell(new Label(9, 2, "医保类别", wcfFC));
            wsheet.addCell(new Label(10, 2, "基药", wcfFC));
            wsheet.addCell(new Label(11, 2, "一致性评价", wcfFC));
            wsheet.addCell(new Label(12, 2, "15版指导原则", wcfFC));
            wsheet.addCell(new Label(13, 2, "预选会意见", wcfFC));
            wsheet.addCell(new Label(14, 2, "备注", wcfFC));
            wsheet.addCell(new Label(15, 2, "表决意见", wcfFC));


            // 表头结束

            wfont = new jxl.write.WritableFont(WritableFont.ARIAL, 10, WritableFont.NO_BOLD, false, UnderlineStyle.NO_UNDERLINE, Colour.BLACK);
            wcfFC = new WritableCellFormat(wfont);
            wcfFC.setBorder(jxl.format.Border.ALL, jxl.format.BorderLineStyle.THIN);
            wcfFC.setVerticalAlignment(VerticalAlignment.CENTRE);   //设置居中对齐
            wcfFC.setAlignment(Alignment.CENTRE);
            wcfFC.setWrap(true);

            int count = mmList.size();
            int mmpinzhongKaishihang = 3;
            int mmpinpaiKaishihang = 3;


            for (int i = 0; i < count; i++) {
                Map<String, Object> mmPinzhongMap = mmList.get(i);

                String mmPinzhongOne = mmPinzhongMap.get("xuhao") == null ? "" : mmPinzhongMap.get("xuhao").toString();
                int mmHebingshu = 0;

                List<Map<String, Object>> mmPinguilist = fujiankjjibenMapper.findqianzibiaoResult(ppxiangmuid, mmPinzhongOne,ppuserid);
                if (mmPinguilist.size() > 0) {
                    mmHebingshu = mmPinguilist.size() - 1;
                }
                for (int j = 0; j < mmPinguilist.size(); j++) {
                    Map<String, Object> mmPinguiMap = mmPinguilist.get(j);
                    if (mmPinguiMap != null) {
                        String yaopinmingcheng = mmPinguiMap.get("yaopinmingcheng") == null ? "" : mmPinguiMap.get("yaopinmingcheng").toString();
                        String chanpinbianma = mmPinguiMap.get("beuzhu1") == null ? "" : mmPinguiMap.get("beuzhu1").toString();
                        String fenlei = mmPinguiMap.get("fenlei") == null ? "" : mmPinguiMap.get("fenlei").toString();
                        String xianzhi = mmPinguiMap.get("beizhu2") == null ? "" : mmPinguiMap.get("beizhu2").toString();
                        String guige = mmPinguiMap.get("guige") == null ? "" : mmPinguiMap.get("guige").toString();
                        String jiage = mmPinguiMap.get("jiage") == null ? "" : mmPinguiMap.get("jiage").toString();
                        String danwei = mmPinguiMap.get("danwei") == null ? "" : mmPinguiMap.get("danwei").toString();
                        String jixing = mmPinguiMap.get("beizhu3") == null ? "" : mmPinguiMap.get("beizhu3").toString();
                        String shengchanqiye = mmPinguiMap.get("beizhu4") == null ? "" : mmPinguiMap.get("beizhu4").toString();
                        String yibaoleibie = mmPinguiMap.get("yibaoleibie") == null ? "" : mmPinguiMap.get("yibaoleibie").toString();
                        String jiyao = mmPinguiMap.get("jiyao") == null ? "" : mmPinguiMap.get("jiyao").toString();
                        String yizhixingpingjia = mmPinguiMap.get("yizhixingpingjia") == null ? "" : mmPinguiMap.get("yizhixingpingjia").toString();
                        String zhidaoyuanze = mmPinguiMap.get("zhidaoyuanze") == null ? "" : mmPinguiMap.get("zhidaoyuanze").toString();
                        String lincaizongcishu = mmPinguiMap.get("lincaizongcishu") == null ? "" : mmPinguiMap.get("lincaizongcishu").toString();
                        String lincaizongshulinag = mmPinguiMap.get("lincaizongshulinag") == null ? "" : mmPinguiMap.get("lincaizongshulinag").toString();
                        String shenqingkeshi = mmPinguiMap.get("shenqingkeshi") == null ? "" : mmPinguiMap.get("shenqingkeshi").toString();
                        String yuxuanhuiyijian = mmPinguiMap.get("yuxuanhuiyijian") == null ? "" : mmPinguiMap.get("yuxuanhuiyijian").toString();
                        String beizhu = mmPinguiMap.get("beizhu") == null ? "" : mmPinguiMap.get("beizhu").toString();

                        String mmresult = mmPinguiMap.get("result") == null ? "" : mmPinguiMap.get("result").toString();
                        String mmbiaojueren = mmPinguiMap.get("username") == null ? "" : mmPinguiMap.get("username").toString();
                        String mmyijian = "";
                        if ("1".equals(mmresult)) {
                            mmyijian = "同意";
                        } else if ("0".equals(mmresult)) {
                            mmyijian = "不同意";
                        } else {
                            mmyijian = "不同意";
                        }
                        System.out.println("@@@"+mmresult);
                        wsheet.setRowView(mmpinpaiKaishihang,700);
                        wsheet.addCell(new Label(1, mmpinpaiKaishihang, chanpinbianma, wcfFC));
                        wsheet.addCell(new Label(2, mmpinpaiKaishihang, yaopinmingcheng, wcfFC));
                        wsheet.addCell(new Label(3, mmpinpaiKaishihang, fenlei, wcfFC));
                        wsheet.addCell(new Label(4, mmpinpaiKaishihang, guige, wcfFC));
                        wsheet.addCell(new Label(5, mmpinpaiKaishihang, jiage, wcfFC));
                        wsheet.addCell(new Label(6, mmpinpaiKaishihang, danwei, wcfFC));
                        wsheet.addCell(new Label(7, mmpinpaiKaishihang, jixing, wcfFC));
                        wsheet.addCell(new Label(8, mmpinpaiKaishihang, shengchanqiye, wcfFC));
                        wsheet.addCell(new Label(9, mmpinpaiKaishihang, yibaoleibie, wcfFC));
                        wsheet.addCell(new Label(10, mmpinpaiKaishihang, jiyao, wcfFC));
                        wsheet.addCell(new Label(11, mmpinpaiKaishihang, yizhixingpingjia, wcfFC));
                        wsheet.addCell(new Label(12, mmpinpaiKaishihang, zhidaoyuanze, wcfFC));
                        wsheet.addCell(new Label(13, mmpinpaiKaishihang, yuxuanhuiyijian, wcfFC));
                        wsheet.addCell(new Label(14, mmpinpaiKaishihang, beizhu, wcfFC));
                        wsheet.addCell(new Label(15, mmpinpaiKaishihang, mmyijian, wcfFC));
                        mmpinpaiKaishihang = mmpinpaiKaishihang + 1;
                    }
                }
                wsheet.addCell(new Label(0, mmpinzhongKaishihang, mmPinzhongOne, wcfFC));
                wsheet.mergeCells(0, mmpinzhongKaishihang, 0, mmpinzhongKaishihang + mmHebingshu);
                mmpinzhongKaishihang = mmpinzhongKaishihang + mmHebingshu + 1;

            }
            wbook.write(); // 写入文件
            wbook.close();
        } catch (Exception ex) {
            ex.printStackTrace();
        } finally {
            if (os != null) {
                try {
                    os.close();
                } catch (IOException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }
            }
        }
    }
    public void daochuqianzibiao8Pingui(@RequestParam("xiangmuid") String ppxiangmuid,
                                  @RequestParam("userid") String ppuserid,
                                  HttpServletRequest request, HttpServletResponse response) {

        response.reset();
        response.setContentType("application/x-download;charset=utf-8");
        List<Map<String, Object>> mmList = fujianbMapper.selectPingui(ppxiangmuid, 0, Integer.MAX_VALUE);
        String xiangmumingcheng = ysxiangmuService.findOne(ppxiangmuid).getXiangmuname();
        Ysuser mmuser = ddYsuserService.findOne(ppuserid);
        String mmusername = mmuser.getUsername();
        OutputStream os = null;
        WritableWorkbook wbook = null;
        try {
            os = new BufferedOutputStream(response.getOutputStream());//得到输出流的语句
            //response.getOutputStream();// 取得输出流
            response.reset();// 清空输出流
            SimpleDateFormat mmDateFormat = new SimpleDateFormat("yyyyMMdd-HHmmss");
            String wenjiantitle = xiangmumingcheng + mmusername + "委员结果表" + StringHandle.tiemString(); //文件名
            String tmptitle = xiangmumingcheng+"（" + mmusername + "）"; // 标题
            response.setHeader("Content-disposition", "attachment; filename=" + new String(wenjiantitle.getBytes(), "iso8859-1") + ".xls");// 设定输出文件头
            response.setContentType("application/vnd.ms-excel");// 定义输出类型
            wbook = Workbook.createWorkbook(os); // 建立excel文件
            WritableSheet wsheet = wbook.createSheet(tmptitle, 0); // sheet名称
            SheetSettings settings = wsheet.getSettings();
            settings.setProtected(true);
            /*  settings.setPassword("0000");*/
            // 设置excel标题
            WritableFont wfont = new WritableFont(WritableFont.ARIAL, 16, WritableFont.BOLD, false, UnderlineStyle.NO_UNDERLINE, Colour.BLACK); //设置表格样式

            WritableCellFormat wcfFC = new WritableCellFormat(wfont);
            wcfFC.setBorder(jxl.format.Border.ALL, jxl.format.BorderLineStyle.THIN); // 添加边框
            wcfFC.setVerticalAlignment(VerticalAlignment.CENTRE);   //设置居中对齐
            wcfFC.setAlignment(Alignment.CENTRE);

            WritableCellFormat wcfFC3 = new WritableCellFormat(wfont);
            wcfFC3.setVerticalAlignment(VerticalAlignment.CENTRE);   //设置居中对齐
            wcfFC3.setAlignment(Alignment.CENTRE);
            //wcfFC.setBackground(Colour.AQUA);
            Label label = new Label(0, 0, tmptitle, wcfFC3);

            WritableCellFormat cellFormat = new WritableCellFormat();
            cellFormat.setAlignment(jxl.format.Alignment.CENTRE);
            cellFormat.setVerticalAlignment(jxl.format.VerticalAlignment.CENTRE);
            cellFormat.setWrap(true);
            //cellFormat.setBackground(Colour.AQUA);
            cellFormat.setFont(wfont);
            label.setCellFormat(cellFormat);
            wsheet.addCell(label);
            wsheet.addCell(new Label(0, 0, tmptitle, wcfFC3));
            /*wsheet.addCell(new Label(7, 0, tmptitle, wcfFC));*/
            wsheet.setRowView(0, 600); //第一行高度
            wsheet.setRowView(1, 600); //第二行高度
            wsheet.mergeCells(0, 0, 9, 0);  //合并单元格(第一列的第一行和第十三列的第一行合并)
            wsheet.setColumnView(0, 6); //宽度
            wsheet.setColumnView(1, 27); //宽度
            wsheet.setColumnView(2, 45); //药品名称宽度
            wsheet.setColumnView(3, 12); //分类宽度
            wsheet.setColumnView(4, 10); //规格宽度
            wsheet.setColumnView(5, 15); //单位宽度
            wsheet.setColumnView(6, 9); //医保宽度
            wsheet.setColumnView(7, 16); //宽度
            wsheet.setColumnView(8, 10); //宽度
            wsheet.setColumnView(9, 10); //宽度



            // 开始生成主体内容
            wfont = new jxl.write.WritableFont(WritableFont.ARIAL, 10, WritableFont.BOLD, false, UnderlineStyle.NO_UNDERLINE, Colour.BLACK);
            wcfFC = new WritableCellFormat(wfont);
            wcfFC.setBorder(jxl.format.Border.ALL, jxl.format.BorderLineStyle.THIN);
            wcfFC.setVerticalAlignment(VerticalAlignment.CENTRE);   //设置居中对齐
            wcfFC.setAlignment(Alignment.CENTRE);
            wcfFC.setWrap(true);
            // 不需要边框和居中的样式
            WritableFont wfont2 = new WritableFont(WritableFont.ARIAL, 12, WritableFont.BOLD, false, UnderlineStyle.NO_UNDERLINE, Colour.BLACK); //设置表格样式
            WritableCellFormat wcfFC2 = new WritableCellFormat(wfont2);
            wcfFC2.setVerticalAlignment(jxl.format.VerticalAlignment.CENTRE);// 垂直居中
            wcfFC2 = new WritableCellFormat(wfont2);
            wcfFC2.setWrap(true);
            //  在  1 列  2 行 写入内容
            wsheet.addCell(new Label(0, 1, "投票人(签字):投票内容已核对无误。" + mmusername, wcfFC2));
            // 把  0 列 2 行 到 9 列 2 行合并
            wsheet.mergeCells(0, 1, 4, 1);


            wsheet.addCell(new Label(5, 1, "投票日期:" + StringHandle.shorttiemString(), wcfFC2));
            wsheet.mergeCells(5, 1, 9, 1);

            // 第三行 内容
            wsheet.addCell(new Label(0, 2, "序号", wcfFC));
            wsheet.addCell(new Label(1, 2, "药品名称", wcfFC));
            wsheet.addCell(new Label(2, 2, "规格", wcfFC));
            wsheet.addCell(new Label(3, 2, "是否为新增品种", wcfFC));
            wsheet.addCell(new Label(4, 2, "有无临床需求", wcfFC));
            wsheet.addCell(new Label(5, 2, "申请科室", wcfFC));
            wsheet.addCell(new Label(6, 2, "有无同功效品种", wcfFC));
            wsheet.addCell(new Label(7, 2, "预选会意见", wcfFC));
            wsheet.addCell(new Label(8, 2, "备注", wcfFC));
            wsheet.addCell(new Label(9, 2, "表决意见", wcfFC));


            // 表头结束

            wfont = new jxl.write.WritableFont(WritableFont.ARIAL, 10, WritableFont.NO_BOLD, false, UnderlineStyle.NO_UNDERLINE, Colour.BLACK);
            wcfFC = new WritableCellFormat(wfont);
            wcfFC.setBorder(jxl.format.Border.ALL, jxl.format.BorderLineStyle.THIN);
            wcfFC.setVerticalAlignment(VerticalAlignment.CENTRE);   //设置居中对齐
            wcfFC.setAlignment(Alignment.CENTRE);
            wcfFC.setWrap(true);

            int count = mmList.size();
            int mmpinzhongKaishihang = 3;
            int mmpinpaiKaishihang = 3;


            for (int i = 0; i < count; i++) {
                Map<String, Object> mmPinzhongMap = mmList.get(i);

                String mmPinzhongOne = mmPinzhongMap.get("xuhao") == null ? "" : mmPinzhongMap.get("xuhao").toString();
                int mmHebingshu = 0;

                List<Map<String, Object>> mmPinguilist = fujianbMapper.findPinzhongByPingui(ppxiangmuid, mmPinzhongOne, ppuserid);
                if (mmPinguilist.size() > 0) {
                    mmHebingshu = mmPinguilist.size() - 1;
                }
                for (int j = 0; j < mmPinguilist.size(); j++) {
                    Map<String, Object> mmPinguiMap = mmPinguilist.get(j);
                    if (mmPinguiMap != null) {
                        String yaopinmingcheng = mmPinguiMap.get("yaopinmingcheng") == null ? "" : mmPinguiMap.get("yaopinmingcheng").toString();
                        String guige = mmPinguiMap.get("guige") == null ? "" : mmPinguiMap.get("guige").toString();
                        String shifouxinzengpinzhong = mmPinguiMap.get("shifouxinzengpinzhong") == null ? "" : mmPinguiMap.get("shifouxinzengpinzhong").toString();
                        String youwulinchuangxuqiu = mmPinguiMap.get("youwulinchuangxuqiu") == null ? "" : mmPinguiMap.get("youwulinchuangxuqiu").toString();
                        String youwutonggongxiao = mmPinguiMap.get("youwutonggongxiao") == null ? "" : mmPinguiMap.get("youwutonggongxiao").toString();
                        String yuxuanhuiyijian = mmPinguiMap.get("yuxuanhuiyijian") == null ? "" : mmPinguiMap.get("yuxuanhuiyijian").toString();
                        String shenqingkeshi = mmPinguiMap.get("shenqingkeshi") == null ? "" : mmPinguiMap.get("shenqingkeshi").toString();
                        String beizhu = mmPinguiMap.get("beizhu") == null ? "" : mmPinguiMap.get("beizhu").toString();

                        String mmresult = mmPinguiMap.get("result") == null ? "" : mmPinguiMap.get("result").toString();
                        String mmbiaojueren = mmPinguiMap.get("username") == null ? "" : mmPinguiMap.get("username").toString();
                        String mmyijian = "";
                        if ("1".equals(mmresult)) {
                            mmyijian = "同意";
                        } else if ("0".equals(mmresult)) {
                            mmyijian = "不同意";
                        } else {
                            mmyijian = "不同意";
                        }
                        wsheet.setRowView(mmpinpaiKaishihang,700);

                        wsheet.addCell(new Label(1, mmpinpaiKaishihang, yaopinmingcheng, wcfFC));
                        wsheet.addCell(new Label(2, mmpinpaiKaishihang, guige, wcfFC));
                        wsheet.addCell(new Label(3, mmpinpaiKaishihang, shifouxinzengpinzhong, wcfFC));
                        wsheet.addCell(new Label(4, mmpinpaiKaishihang, youwulinchuangxuqiu, wcfFC));
                        wsheet.addCell(new Label(5, mmpinpaiKaishihang, shenqingkeshi, wcfFC));
                        wsheet.addCell(new Label(6, mmpinpaiKaishihang, youwutonggongxiao, wcfFC));
                        wsheet.addCell(new Label(7, mmpinpaiKaishihang, yuxuanhuiyijian, wcfFC));
                        wsheet.addCell(new Label(8, mmpinpaiKaishihang, beizhu, wcfFC));
                        wsheet.addCell(new Label(9, mmpinpaiKaishihang, mmyijian, wcfFC));
                        mmpinpaiKaishihang = mmpinpaiKaishihang + 1;
                    }
                }
                wsheet.addCell(new Label(0, mmpinzhongKaishihang, mmPinzhongOne, wcfFC));
                wsheet.mergeCells(0, mmpinzhongKaishihang, 0, mmpinzhongKaishihang + mmHebingshu);
                mmpinzhongKaishihang = mmpinzhongKaishihang + mmHebingshu + 1;

            }
            wbook.write(); // 写入文件
            wbook.close();
        } catch (Exception ex) {
            ex.printStackTrace();
        } finally {
            if (os != null) {
                try {
                    os.close();
                } catch (IOException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }
            }
        }
    }
}